\input{preamble}

% OK, start here.
%
\begin{document}

\title{More on Flatness}

\maketitle

\phantomsection
\label{section-phantom}

\tableofcontents



\section{Introduction}
\label{section-introduction}

\noindent
In this chapter, we discuss some advanced results on flat modules and
flat morphisms of schemes and applications. Most of the results on flatness
can be found in the paper \cite{GruRay} by Raynaud and Gruson.

\medskip\noindent
Before reading this chapter we advise the reader to take a look
at the following results (this list also serves as a pointer to
previous results):
\begin{enumerate}
\item General discussion on flat modules in
Algebra, Section \ref{algebra-section-flat}.
\item The relationship between $\text{Tor}$-groups and flatness, see
Algebra, Section \ref{algebra-section-tor}.
\item Criteria for flatness, see
Algebra, Section \ref{algebra-section-criteria-flatness}
(Noetherian case),
Algebra, Section \ref{algebra-section-flatness-artinian}
(Artinian case),
Algebra, Section \ref{algebra-section-more-flatness-criteria}
(non-Noetherian case), and finally
More on Morphisms, Section \ref{more-morphisms-section-criterion-flat-fibres}.
\item Generic flatness, see
Algebra, Section \ref{algebra-section-generic-flatness}
and
Morphisms, Section \ref{morphisms-section-generic-flatness}.
\item Openness of the flat locus, see
Algebra, Section \ref{algebra-section-open-flat}
and
More on Morphisms, Section \ref{more-morphisms-section-open-flat}.
\item Flattening, see
More on Algebra, Sections
\ref{more-algebra-section-flattening},
\ref{more-algebra-section-flattening-artinian},
\ref{more-algebra-section-flattening-local-base},
\ref{more-algebra-section-flattening-local-source-base}, and
\ref{more-algebra-section-flattening-Noetherian-complete-local}.
\item Additional results in
More on Algebra, Sections \ref{more-algebra-section-descent-flatness-integral},
\ref{more-algebra-section-torsion-flat},
\ref{more-algebra-section-flat-finite}, and
\ref{more-algebra-section-blowup-flat}.
\end{enumerate}
As applications of the material on flatness we discuss the following
topics: a non-Noetherian version of Grothendieck's existence theorem,
blowing up and flatness, Nagata's theorem on compactifications,
the h topology, blow up squares and descent, weak normalization,
descent of vector bundles in positive characteristic, and
the local structure of perfect complexes in the h topology.






\section{Lemmas on \'etale localization}
\label{section-etale-localization}

\noindent
In this section we list some lemmas on \'etale localization which will be
useful later in this chapter. Please skip this section on a first reading.

\begin{lemma}
\label{lemma-lift-etale}
Let $i : Z \to X$ be a closed immersion of affine schemes.
Let $Z' \to Z$ be an \'etale morphism with $Z'$ affine.
Then there exists an \'etale morphism $X' \to X$ with $X'$
affine such that $Z' \cong Z \times_X X'$ as schemes over $Z$.
\end{lemma}

\begin{proof}
See
Algebra, Lemma \ref{algebra-lemma-lift-etale}.
\end{proof}

\begin{lemma}
\label{lemma-etale-at-point}
Let
$$
\xymatrix{
X \ar[d] & X' \ar[l] \ar[d] \\
S & S' \ar[l]
}
$$
be a commutative diagram of schemes with $X' \to X$ and $S' \to S$ \'etale.
Let $s' \in S'$ be a point. Then
$$
X' \times_{S'} \Spec(\mathcal{O}_{S', s'})
\longrightarrow
X \times_S \Spec(\mathcal{O}_{S', s'})
$$
is \'etale.
\end{lemma}

\begin{proof}
This is true because $X' \to X_{S'}$ is \'etale as a morphism of
schemes \'etale over $X$, see
Morphisms, Lemma \ref{morphisms-lemma-etale-permanence}
and the base change of an \'etale morphism is \'etale, see
Morphisms, Lemma \ref{morphisms-lemma-base-change-etale}.
\end{proof}

\begin{lemma}
\label{lemma-etale-flat-up-down}
Let $X \to T \to S$ be morphisms of schemes with $T \to S$ \'etale.
Let $\mathcal{F}$ be a quasi-coherent $\mathcal{O}_X$-module.
Let $x \in X$ be a point. Then
$$
\mathcal{F}\text{ flat over }S\text{ at }x
\Leftrightarrow
\mathcal{F}\text{ flat over }T\text{ at }x
$$
In particular $\mathcal{F}$ is flat over $S$ if and only if $\mathcal{F}$
is flat over $T$.
\end{lemma}

\begin{proof}
As an \'etale morphism is a flat morphism (see
Morphisms, Lemma \ref{morphisms-lemma-etale-flat})
the implication ``$\Leftarrow$'' follows from
Algebra, Lemma \ref{algebra-lemma-composition-flat}.
For the converse assume that $\mathcal{F}$ is flat at $x$ over $S$.
Denote $\tilde x \in X \times_S T$ the point lying over $x$ in $X$
and over the image of $x$ in $T$ in $T$.
Then $(X \times_S T \to X)^*\mathcal{F}$ is flat at $\tilde x$ over $T$
via $\text{pr}_2 : X \times_S T \to T$, see
Morphisms, Lemma \ref{morphisms-lemma-base-change-module-flat}.
The diagonal $\Delta_{T/S} : T \to T \times_S T$ is an open immersion;
combine
Morphisms, Lemmas \ref{morphisms-lemma-diagonal-unramified-morphism} and
\ref{morphisms-lemma-etale-smooth-unramified}.
So $X$ is identified with open subscheme of $X \times_S T$,
the restriction of $\text{pr}_2$ to this open is the given morphism $X \to T$,
the point $\tilde x$ corresponds to the point $x$ in this open, and
$(X \times_S T \to X)^*\mathcal{F}$ restricted to this open is $\mathcal{F}$.
Whence we see that $\mathcal{F}$ is flat at $x$ over $T$.
\end{proof}

\begin{lemma}
\label{lemma-etale-flat-up-down-local-ring}
Let $T \to S$ be an \'etale morphism. Let $t \in T$ with image $s \in S$.
Let $M$ be a $\mathcal{O}_{T, t}$-module. Then
$$
M\text{ flat over }\mathcal{O}_{S, s}
\Leftrightarrow
M\text{ flat over }\mathcal{O}_{T, t}.
$$
\end{lemma}

\begin{proof}
We may replace $S$ by an affine neighbourhood of $s$ and after that
$T$ by an affine neighbourhood of $t$.
Set $\mathcal{F} = (\Spec(\mathcal{O}_{T, t}) \to T)_*\widetilde M$.
This is a quasi-coherent sheaf (see
Schemes, Lemma \ref{schemes-lemma-push-forward-quasi-coherent}
or argue directly)
on $T$ whose stalk at $t$ is $M$ (details omitted).
Apply
Lemma \ref{lemma-etale-flat-up-down}.
\end{proof}

\begin{lemma}
\label{lemma-flat-up-down-henselization}
Let $S$ be a scheme and $s \in S$ a point. Denote $\mathcal{O}_{S, s}^h$
(resp.\ $\mathcal{O}_{S, s}^{sh}$) the henselization (resp.\ strict
henselization), see
Algebra, Definition \ref{algebra-definition-henselization}.
Let $M^{sh}$ be a $\mathcal{O}_{S, s}^{sh}$-module.
The following are equivalent
\begin{enumerate}
\item $M^{sh}$ is flat over $\mathcal{O}_{S, s}$,
\item $M^{sh}$ is flat over $\mathcal{O}_{S, s}^h$, and
\item $M^{sh}$ is flat over $\mathcal{O}_{S, s}^{sh}$.
\end{enumerate}
If $M^{sh} = M^h \otimes_{\mathcal{O}_{S, s}^h} \mathcal{O}_{S, s}^{sh}$
this is also equivalent to
\begin{enumerate}
\item[(4)] $M^h$ is flat over $\mathcal{O}_{S, s}$, and
\item[(5)] $M^h$ is flat over $\mathcal{O}_{S, s}^h$.
\end{enumerate}
If $M^h = M \otimes_{\mathcal{O}_{S, s}} \mathcal{O}_{S, s}^h$
this is also equivalent to
\begin{enumerate}
\item[(6)] $M$ is flat over $\mathcal{O}_{S, s}$.
\end{enumerate}
\end{lemma}

\begin{proof}
By More on Algebra, Lemma
\ref{more-algebra-lemma-dumb-properties-henselization}
the local ring maps
$\mathcal{O}_{S, s} \to \mathcal{O}_{S, s}^h \to \mathcal{O}_{S, s}^{sh}$
are faithfully flat.
Hence (3) $\Rightarrow$ (2) $\Rightarrow$ (1) and
(5) $\Rightarrow$ (4) follow from
Algebra, Lemma \ref{algebra-lemma-composition-flat}.
By faithful flatness the equivalences (6) $\Leftrightarrow$ (5) and
(5) $\Leftrightarrow$ (3) follow from
Algebra, Lemma \ref{algebra-lemma-flatness-descends}.
Thus it suffices to show that
(1) $\Rightarrow$ (2) $\Rightarrow$ (3) and
(4) $\Rightarrow$ (5).
To prove these we may assume $S$ is an affine scheme.

\medskip\noindent
Assume (1). By
Lemma \ref{lemma-etale-flat-up-down-local-ring}
we see that $M^{sh}$ is flat over $\mathcal{O}_{T, t}$ for
any \'etale neighbourhood $(T, t) \to (S, s)$. Since $\mathcal{O}_{S, s}^h$
and $\mathcal{O}_{S, s}^{sh}$ are directed colimits of local rings
of the form $\mathcal{O}_{T, t}$ (see
Algebra, Lemmas \ref{algebra-lemma-henselization-different}
and \ref{algebra-lemma-strict-henselization-different})
we conclude that $M^{sh}$ is flat over $\mathcal{O}_{S, s}^h$
and $\mathcal{O}_{S, s}^{sh}$ by
Algebra, Lemma \ref{algebra-lemma-colimit-rings-flat}.
Thus (1) implies (2) and (3). Of course this implies also
(2) $\Rightarrow$ (3) by replacing $\mathcal{O}_{S, s}$ by
$\mathcal{O}_{S, s}^h$. The same argument applies to prove
(4) $\Rightarrow$ (5).
\end{proof}

\begin{lemma}
\label{lemma-tor-amplitude-up-down-henselization}
Let $S$ be a scheme and $s \in S$ a point. Denote $\mathcal{O}_{S, s}^h$
(resp.\ $\mathcal{O}_{S, s}^{sh}$) the henselization (resp.\ strict
henselization), see
Algebra, Definition \ref{algebra-definition-henselization}.
Let $M^{sh}$ be an object of $D(\mathcal{O}_{S, s}^{sh})$.
Let $a, b \in \mathbf{Z}$.
The following are equivalent
\begin{enumerate}
\item $M^{sh}$ has tor amplitude in $[a, b]$ over $\mathcal{O}_{S, s}$,
\item $M^{sh}$ has tor amplitude in $[a, b]$ over $\mathcal{O}_{S, s}^h$, and
\item $M^{sh}$ has tor amplitude in $[a, b]$ over $\mathcal{O}_{S, s}^{sh}$.
\end{enumerate}
If $M^{sh} =
M^h \otimes_{\mathcal{O}_{S, s}^h}^\mathbf{L} \mathcal{O}_{S, s}^{sh}$
for $M^h \in D(\mathcal{O}_{S, s}^h)$ this is also equivalent to
\begin{enumerate}
\item[(4)] $M^h$ has tor amplitude in $[a, b]$ over $\mathcal{O}_{S, s}$, and
\item[(5)] $M^h$ has tor amplitude in $[a, b]$ over $\mathcal{O}_{S, s}^h$.
\end{enumerate}
If $M^h = M \otimes_{\mathcal{O}_{S, s}}^\mathbf{L} \mathcal{O}_{S, s}^h$
for $M \in D(\mathcal{O}_{S, s})$
this is also equivalent to
\begin{enumerate}
\item[(6)] $M$ has tor amplitude in $[a, b]$ over $\mathcal{O}_{S, s}$.
\end{enumerate}
\end{lemma}

\begin{proof}
By More on Algebra, Lemma
\ref{more-algebra-lemma-dumb-properties-henselization}
the local ring maps
$\mathcal{O}_{S, s} \to \mathcal{O}_{S, s}^h \to \mathcal{O}_{S, s}^{sh}$
are faithfully flat.
Hence (3) $\Rightarrow$ (2) $\Rightarrow$ (1) and
(5) $\Rightarrow$ (4) follow from
More on Algebra, Lemma \ref{more-algebra-lemma-flat-push-tor-amplitude}.
By faithful flatness the equivalences (6) $\Leftrightarrow$ (5) and
(5) $\Leftrightarrow$ (3) follow from
More on Algebra, Lemma \ref{more-algebra-lemma-flat-descent-tor-amplitude}.
Thus it suffices to show that
(1) $\Rightarrow$ (3), (2) $\Rightarrow$ (3), and (4) $\Rightarrow$ (5).

\medskip\noindent
Assume (1). In particular $M^{sh}$ has vanishing cohomology
in degrees $< a$ and $> b$. Hence we can represent $M^{sh}$ by a complex
$P^\bullet$ of free $\mathcal{O}_{X, x}^{sh}$-modules with
$P^i = 0$ for $i > b$
(see for example the very general
Derived Categories, Lemma \ref{derived-lemma-subcategory-left-resolution}).
Note that $P^n$ is flat over $\mathcal{O}_{S, s}$ for all $n$.
Consider $\Coker(d_P^{a - 1})$. By More on Algebra, Lemma
\ref{more-algebra-lemma-last-one-flat}
this is a flat $\mathcal{O}_{S, s}$-module.
Hence by Lemma \ref{lemma-flat-up-down-henselization}
this is a flat $\mathcal{O}_{S, s}^{sh}$-module.
Thus $\tau_{\geq a}P^\bullet$ is a complex of
flat $\mathcal{O}_{S, s}^{sh}$-modules representing $M^{sh}$
in $D(\mathcal{O}_{S, s}^{sh}$ and we find that
$M^{sh}$ has tor amplitude in $[a, b]$, see
More on Algebra, Lemma \ref{more-algebra-lemma-tor-amplitude}.
Thus (1) implies (3). Of course this implies also
(2) $\Rightarrow$ (3) by replacing $\mathcal{O}_{S, s}$ by
$\mathcal{O}_{S, s}^h$. The same argument applies to prove
(4) $\Rightarrow$ (5).
\end{proof}

\begin{lemma}
\label{lemma-finite-flat-weak-assassin-up-down}
Let $g : T \to S$ be a finite flat morphism of schemes.
Let $\mathcal{G}$ be a quasi-coherent $\mathcal{O}_S$-module.
Let $t \in T$ be a point with image $s \in S$. Then
$$
t \in \text{WeakAss}(g^*\mathcal{G})
\Leftrightarrow
s \in \text{WeakAss}(\mathcal{G})
$$
\end{lemma}

\begin{proof}
The implication ``$\Leftarrow$'' follows immediately from
Divisors, Lemma \ref{divisors-lemma-weakly-ass-pullback}.
Assume $t \in \text{WeakAss}(g^*\mathcal{G})$.
Let $\Spec(A) \subset S$ be an affine open neighbourhood of $s$.
Let $\mathcal{G}$ be the quasi-coherent sheaf associated to the $A$-module $M$.
Let $\mathfrak p \subset A$ be the prime ideal corresponding to $s$.
As $g$ is finite flat we have $g^{-1}(\Spec(A)) = \Spec(B)$
for some finite flat $A$-algebra $B$. Note that
$g^*\mathcal{G}$ is the quasi-coherent $\mathcal{O}_{\Spec(B)}$-module
associated to the $B$-module $M \otimes_A B$ and $g_*g^*\mathcal{G}$ is the
quasi-coherent $\mathcal{O}_{\Spec(A)}$-module associated to the
$A$-module $M \otimes_A B$. By
Algebra, Lemma \ref{algebra-lemma-finite-flat-local}
we have $B_{\mathfrak p} \cong A_{\mathfrak p}^{\oplus n}$
for some integer $n \geq 0$. Note that $n \geq 1$ as we assumed there
exists at least one point of $T$ lying over $s$. Hence we see by
looking at stalks that
$$
s \in \text{WeakAss}(\mathcal{G})
\Leftrightarrow
s \in \text{WeakAss}(g_*g^*\mathcal{G})
$$
Now the assumption that $t \in \text{WeakAss}(g^*\mathcal{G})$
implies that $s \in \text{WeakAss}(g_*g^*\mathcal{G})$ by
Divisors, Lemma \ref{divisors-lemma-weakly-associated-finite}
and hence by the above $s \in  \text{WeakAss}(\mathcal{G})$.
\end{proof}

\begin{lemma}
\label{lemma-etale-weak-assassin-up-down}
Let $h : U \to S$ be an \'etale morphism of schemes.
Let $\mathcal{G}$ be a quasi-coherent $\mathcal{O}_S$-module.
Let $u \in U$ be a point with image $s \in S$. Then
$$
u \in \text{WeakAss}(h^*\mathcal{G})
\Leftrightarrow
s \in \text{WeakAss}(\mathcal{G})
$$
\end{lemma}

\begin{proof}
After replacing $S$ and $U$ by affine neighbourhoods of $s$ and $u$
we may assume that $g$ is a standard \'etale morphism of affines, see
Morphisms, Lemma \ref{morphisms-lemma-etale-locally-standard-etale}.
Thus we may assume $S = \Spec(A)$ and
$X = \Spec(A[x, 1/g]/(f))$, where $f$ is monic and $f'$
is invertible in $A[x, 1/g]$.
Note that $A[x, 1/g]/(f) = (A[x]/(f))_g$ is also the localization
of the finite free $A$-algebra $A[x]/(f)$. Hence we may think of
$U$ as an open subscheme of the scheme $T = \Spec(A[x]/(f))$
which is finite locally free over $S$. This reduces us to
Lemma \ref{lemma-finite-flat-weak-assassin-up-down}
above.
\end{proof}

\begin{lemma}
\label{lemma-weakly-associated-henselization}
Let $S$ be a scheme and $s \in S$ a point. Denote $\mathcal{O}_{S, s}^h$
(resp.\ $\mathcal{O}_{S, s}^{sh}$) the henselization (resp.\ strict
henselization), see
Algebra, Definition \ref{algebra-definition-henselization}.
Let $\mathcal{F}$ be a quasi-coherent $\mathcal{O}_S$-module.
The following are equivalent
\begin{enumerate}
\item $s$ is a weakly associated point of $\mathcal{F}$,
\item $\mathfrak m_s$ is a weakly associated prime of $\mathcal{F}_s$,
\item $\mathfrak m_s^h$ is a weakly associated prime of
$\mathcal{F}_s \otimes_{\mathcal{O}_{S, s}} \mathcal{O}_{S, s}^h$, and
\item $\mathfrak m_s^{sh}$ is a weakly associated prime of
$\mathcal{F}_s \otimes_{\mathcal{O}_{S, s}} \mathcal{O}_{S, s}^{sh}$.
\end{enumerate}
\end{lemma}

\begin{proof}
The equivalence of (1) and (2) is the definition, see
Divisors, Definition \ref{divisors-definition-weakly-associated}.
The implications (2) $\Rightarrow$ (3) $\Rightarrow$ (4)
follows from Divisors, Lemma \ref{divisors-lemma-weakly-ass-pullback}
applied to the flat (More on Algebra, Lemma
\ref{more-algebra-lemma-dumb-properties-henselization})
morphisms
$$
\Spec(\mathcal{O}_{S, s}^{sh}) \to
\Spec(\mathcal{O}_{S, s}^h) \to
\Spec(\mathcal{O}_{S, s})
$$
and the closed points. To prove (4) $\Rightarrow$ (2) we may replace
$S$ by an affine neighbourhood. Suppose that
$x \in \mathcal{F}_s \otimes_{\mathcal{O}_{S, s}} \mathcal{O}_{S, s}^{sh}$
is an element whose annihilator has radical equal to $\mathfrak m_s^{sh}$.
(See Algebra, Lemma \ref{algebra-lemma-weakly-ass-local}.)
Since $\mathcal{O}_{S, s}^{sh}$ is equal to the limit
of $\mathcal{O}_{U, u}$ over \'etale neighbourhoods
$f : (U, u) \to (S, s)$ by Algebra, Lemma
\ref{algebra-lemma-strict-henselization-different}
we may assume that $x$ is the image of some
$x' \in \mathcal{F}_s \otimes_{\mathcal{O}_{S, s}} \mathcal{O}_{U, u}$.
The local ring map $\mathcal{O}_{U, u} \to \mathcal{O}_{S, s}^{sh}$
is faithfully flat (as it is the strict henselization), hence
universally injective
(Algebra, Lemma \ref{algebra-lemma-faithfully-flat-universally-injective}).
It follows that the annihilator of $x'$ is the inverse image of the
annihilator of $x$. Hence the radical of this annihilator
is equal to $\mathfrak m_u$.
Thus $u$ is a weakly associated point of $f^*\mathcal{F}$.
By Lemma \ref{lemma-etale-weak-assassin-up-down}
we see that $s$ is a weakly associated point of $\mathcal{F}$.
\end{proof}





\section{The local structure of a finite type module}
\label{section-local-structure-module}

\noindent
The key technical lemma that makes a lot of the arguments in this
chapter work is the geometric
Lemma \ref{lemma-elementary-devissage}.

\begin{lemma}
\label{lemma-sheaf-lives-on-subscheme}
Let $f : X \to S$ be a finite type morphism of affine schemes.
Let $\mathcal{F}$ be a finite type quasi-coherent $\mathcal{O}_X$-module.
Let $x \in X$ with image $s = f(x)$ in $S$.
Set $\mathcal{F}_s = \mathcal{F}|_{X_s}$.
Then there exist a closed immersion $i : Z \to X$ of finite presentation,
and a quasi-coherent finite type $\mathcal{O}_Z$-module $\mathcal{G}$
such that $i_*\mathcal{G} = \mathcal{F}$ and
$Z_s = \text{Supp}(\mathcal{F}_s)$.
\end{lemma}

\begin{proof}
Say the morphism $f : X \to S$ is given by the ring map
$A \to B$ and that $\mathcal{F}$ is the quasi-coherent sheaf
associated to the $B$-module $M$. By
Morphisms, Lemma \ref{morphisms-lemma-locally-finite-type-characterize}
we know that $A \to B$ is a finite type ring map, and by
Properties, Lemma \ref{properties-lemma-finite-type-module}
we know that $M$ is a finite $B$-module. In particular the
support of $\mathcal{F}$ is the closed subscheme of $\Spec(B)$
cut out by the annihilator
$I = \{x \in B \mid xm = 0\ \forall m \in M\}$ of $M$, see
Algebra, Lemma \ref{algebra-lemma-support-closed}.
Let $\mathfrak q \subset B$ be the prime ideal corresponding to $x$
and let $\mathfrak p \subset A$ be the prime ideal corresponding to $s$.
Note that $X_s = \Spec(B \otimes_A \kappa(\mathfrak p))$ and
that $\mathcal{F}_s$ is the quasi-coherent sheaf associated to the
$B \otimes_A \kappa(\mathfrak p)$ module $M \otimes_A \kappa(\mathfrak p)$. By
Morphisms, Lemma \ref{morphisms-lemma-support-finite-type}
the support of $\mathcal{F}_s$ is equal to
$V(I(B \otimes_A \kappa(\mathfrak p)))$. Since
$B \otimes_A \kappa(\mathfrak p)$ is of finite type over $\kappa(\mathfrak p)$
there exist finitely many elements $f_1, \ldots, f_m \in I$
such that
$$
I(B \otimes_A \kappa(\mathfrak p)) =
(f_1, \ldots, f_n)(B \otimes_A \kappa(\mathfrak p)).
$$
Denote $i : Z \to X$ the closed subscheme cut out by
$(f_1, \ldots, f_m)$, in a formula $Z = \Spec(B/(f_1, \ldots, f_m))$.
Since $M$ is annihilated by $I$ we can think of $M$ as an
$B/(f_1, \ldots, f_m)$-module. In other words, $\mathcal{F}$ is the
pushforward of a finite type module on $Z$.
As $Z_s = \text{Supp}(\mathcal{F}_s)$ by construction, this
proves the lemma.
\end{proof}

\begin{lemma}
\label{lemma-elementary-devissage}
Let $f : X \to S$ be morphism of schemes which is locally of finite type.
Let $\mathcal{F}$ be a finite type quasi-coherent $\mathcal{O}_X$-module.
Let $x \in X$ with image $s = f(x)$ in $S$.
Set $\mathcal{F}_s = \mathcal{F}|_{X_s}$ and
$n = \dim_x(\text{Supp}(\mathcal{F}_s))$.
Then we can construct
\begin{enumerate}
\item elementary \'etale neighbourhoods $g : (X', x') \to (X, x)$,
$e : (S', s') \to (S, s)$,
\item a commutative diagram
$$
\xymatrix{
X \ar[dd]_f & X' \ar[dd] \ar[l]^g & Z' \ar[l]^i \ar[d]^\pi \\
& & Y' \ar[d]^h \\
S & S' \ar[l]_e & S' \ar@{=}[l]
}
$$
\item a point $z' \in Z'$ with $i(z') = x'$, $y' = \pi(z')$, $h(y') = s'$,
\item a finite type quasi-coherent $\mathcal{O}_{Z'}$-module $\mathcal{G}$,
\end{enumerate}
such that the following properties hold
\begin{enumerate}
\item $X'$, $Z'$, $Y'$, $S'$ are affine schemes,
\item $i$ is a closed immersion of finite presentation,
\item $i_*(\mathcal{G}) \cong g^*\mathcal{F}$,
\item $\pi$ is finite and $\pi^{-1}(\{y'\}) = \{z'\}$,
\item the extension $\kappa(y')/\kappa(s')$ is purely transcendental,
\item $h$ is smooth of relative dimension $n$
with geometrically integral fibres.
\end{enumerate}
\end{lemma}

\begin{proof}
Let $V \subset S$ be an affine neighbourhood of $s$.
Let $U \subset f^{-1}(V)$ be an affine neighbourhood of $x$.
Then it suffices to prove the lemma for $f|_U : U \to V$ and
$\mathcal{F}|_U$. Hence in the rest of the proof we assume that
$X$ and $S$ are affine.

\medskip\noindent
First, suppose that $X_s = \text{Supp}(\mathcal{F}_s)$, in particular
$n = \dim_x(X_s)$. Apply
More on Morphisms,
Lemmas \ref{more-morphisms-lemma-local-local-structure-finite-type} and
\ref{more-morphisms-lemma-local-local-structure-finite-type-affine}.
This gives us a commutative diagram
$$
\xymatrix{
X \ar[dd] & X' \ar[l]^g \ar[d]^\pi \\
& Y' \ar[d]^h  \\
S & S' \ar[l]_e
}
$$
and point $x' \in X'$. We set $Z' = X'$, $i = \text{id}$, and
$\mathcal{G} = g^*\mathcal{F}$ to obtain a solution in this case.

\medskip\noindent
In general choose a closed immersion $Z \to X$ and a sheaf
$\mathcal{G}$ on $Z$ as in
Lemma \ref{lemma-sheaf-lives-on-subscheme}.
Applying the result of the previous paragraph to $Z \to S$ and
$\mathcal{G}$ we obtain a diagram
$$
\xymatrix{
X \ar[dd]_f & Z \ar[l] \ar[dd]_{f|_Z} & Z' \ar[l]^g \ar[d]^\pi \\
& & Y' \ar[d]^h \\
S & S \ar@{=}[l] & S' \ar[l]_e
}
$$
and point $z' \in Z'$ satisfying all the required properties.
We will use
Lemma \ref{lemma-lift-etale}
to embed $Z'$ into a scheme \'etale over $X$. We cannot apply the lemma directly
as we want $X'$ to be a scheme over $S'$. Instead we
consider the morphisms
$$
\xymatrix{
Z' \ar[r] & Z \times_S S' \ar[r] & X \times_S S'
}
$$
The first morphism is \'etale by
Morphisms, Lemma \ref{morphisms-lemma-etale-permanence}.
The second is a closed immersion as a base change of a closed immersion.
Finally, as $X$, $S$, $S'$, $Z$, $Z'$ are all affine we may apply
Lemma \ref{lemma-lift-etale}
to get an \'etale morphism of affine schemes $X' \to X \times_S S'$ such that
$$
Z' = (Z \times_S S') \times_{(X \times_S S')} X' = Z \times_X X'.
$$
As $Z \to X$ is a closed immersion of finite presentation, so is $Z' \to X'$.
Let $x' \in X'$ be the point corresponding to $z' \in Z'$.
Then the completed diagram
$$
\xymatrix{
X \ar[dd] & X' \ar[dd] \ar[l] & Z' \ar[l]^i \ar[d]^\pi \\
& & Y' \ar[d]^h \\
S & S' \ar[l]_e & S' \ar@{=}[l]
}
$$
is a solution of the original problem.
\end{proof}

\begin{lemma}
\label{lemma-devissage-finite-presentation}
Assumptions and notation as in
Lemma \ref{lemma-elementary-devissage}.
If $f$ is locally of finite presentation
then $\pi$ is of finite presentation.
In this case the following are equivalent
\begin{enumerate}
\item $\mathcal{F}$ is an $\mathcal{O}_X$-module of finite presentation
in a neighbourhood of $x$,
\item $\mathcal{G}$ is an $\mathcal{O}_{Z'}$-module of finite presentation
in a neighbourhood of $z'$, and
\item $\pi_*\mathcal{G}$ is an $\mathcal{O}_{Y'}$-module of
finite presentation in a neighbourhood of $y'$.
\end{enumerate}
Still assuming $f$ locally of finite presentation the following are
equivalent to each other
\begin{enumerate}
\item[(a)] $\mathcal{F}_x$ is an $\mathcal{O}_{X, x}$-module of finite
presentation,
\item[(b)] $\mathcal{G}_{z'}$ is an $\mathcal{O}_{Z', z'}$-module of
finite presentation, and
\item[(c)] $(\pi_*\mathcal{G})_{y'}$ is an $\mathcal{O}_{Y', y'}$-module
of finite presentation.
\end{enumerate}
\end{lemma}

\begin{proof}
Assume $f$ locally of finite presentation. Then $Z' \to S$ is locally
of finite presentation as a composition of such, see
Morphisms, Lemma \ref{morphisms-lemma-composition-finite-presentation}.
Note that $Y' \to S$ is also locally of finite presentation as a composition
of a smooth and an \'etale morphism. Hence
Morphisms, Lemma \ref{morphisms-lemma-finite-presentation-permanence}
implies $\pi$ is locally of finite presentation.
Since $\pi$ is finite we conclude that it is also separated and
quasi-compact, hence $\pi$ is actually of finite presentation.

\medskip\noindent
To prove the equivalence of (1), (2), and (3) we also consider:
(4) $g^*\mathcal{F}$ is a $\mathcal{O}_{X'}$-module of finite presentation
in a neighbourhood of $x'$. The pullback of a module of finite presentation
is of finite presentation, see
Modules, Lemma \ref{modules-lemma-pullback-finite-presentation}.
Hence (1) $\Rightarrow$ (4).
The \'etale morphism $g$ is open, see
Morphisms, Lemma \ref{morphisms-lemma-etale-open}.
Hence for any open neighbourhood $U' \subset X'$ of $x'$, the image
$g(U')$ is an open neighbourhood of $x$ and the map
$\{U' \to g(U')\}$ is an \'etale covering. Thus (4) $\Rightarrow$ (1) by
Descent, Lemma \ref{descent-lemma-finite-presentation-descends}.
Using
Descent, Lemma \ref{descent-lemma-finite-finitely-presented-module}
and some easy topological arguments (see
More on Morphisms,
Lemma \ref{more-morphisms-lemma-finite-morphism-single-point-in-fibre})
we see that
(4) $\Leftrightarrow$ (2) $\Leftrightarrow$ (3).

\medskip\noindent
To prove the equivalence of (a), (b), (c) consider the ring maps
$$
\mathcal{O}_{X, x} \to
\mathcal{O}_{X', x'} \to
\mathcal{O}_{Z', z'} \leftarrow
\mathcal{O}_{Y', y'}
$$
The first ring map is faithfully flat. Hence
$\mathcal{F}_x$ is of finite presentation over $\mathcal{O}_{X, x}$
if and only if $g^*\mathcal{F}_{x'}$ is of finite presentation over
$\mathcal{O}_{X', x'}$, see
Algebra, Lemma \ref{algebra-lemma-descend-properties-modules}.
The second ring map is surjective (hence finite) and
finitely presented by assumption, hence
$g^*\mathcal{F}_{x'}$ is of finite presentation over $\mathcal{O}_{X', x'}$
if and only if $\mathcal{G}_{z'}$ is of finite presentation over
$\mathcal{O}_{Z', z'}$, see
Algebra, Lemma \ref{algebra-lemma-finite-finitely-presented-extension}.
Because $\pi$ is finite, of finite presentation, and
$\pi^{-1}(\{y'\}) = \{x'\}$ the ring homomorphism
$\mathcal{O}_{Y', y'} \leftarrow \mathcal{O}_{Z', z'}$ is finite
and of finite presentation, see
More on Morphisms,
Lemma \ref{more-morphisms-lemma-finite-morphism-single-point-in-fibre}.
Hence $\mathcal{G}_{z'}$ is of finite presentation over $\mathcal{O}_{Z', z'}$
if and only if $\pi_*\mathcal{G}_{y'}$ is of finite presentation over
$\mathcal{O}_{Y', y'}$, see
Algebra, Lemma \ref{algebra-lemma-finite-finitely-presented-extension}.
\end{proof}

\begin{lemma}
\label{lemma-devissage-flat}
Assumptions and notation as in
Lemma \ref{lemma-elementary-devissage}.
The following are equivalent
\begin{enumerate}
\item $\mathcal{F}$ is flat over $S$ in a neighbourhood of $x$,
\item $\mathcal{G}$ is flat over $S'$ in a neighbourhood of $z'$, and
\item $\pi_*\mathcal{G}$ is flat over $S'$ in a neighbourhood of $y'$.
\end{enumerate}
The following are equivalent also
\begin{enumerate}
\item[(a)] $\mathcal{F}_x$ is flat over $\mathcal{O}_{S, s}$,
\item[(b)] $\mathcal{G}_{z'}$ is flat over $\mathcal{O}_{S', s'}$, and
\item[(c)] $(\pi_*\mathcal{G})_{y'}$ is flat over $\mathcal{O}_{S', s'}$.
\end{enumerate}
\end{lemma}

\begin{proof}
To prove the equivalence of (1), (2), and (3) we also consider:
(4) $g^*\mathcal{F}$ is flat over $S$ in a neighbourhood of $x'$.
We will use
Lemma \ref{lemma-etale-flat-up-down}
to equate flatness over $S$ and $S'$ without further mention.
The \'etale morphism $g$ is flat and open, see
Morphisms, Lemma \ref{morphisms-lemma-etale-open}.
Hence for any open neighbourhood $U' \subset X'$ of $x'$, the image
$g(U')$ is an open neighbourhood of $x$ and the map
$U' \to g(U')$ is surjective and flat.
Thus (4) $\Leftrightarrow$ (1) by
Morphisms, Lemma \ref{morphisms-lemma-flat-permanence}.
Note that
$$
\Gamma(X', g^*\mathcal{F}) =
\Gamma(Z', \mathcal{G}) =
\Gamma(Y', \pi_*\mathcal{G})
$$
Hence the flatness of $g^*\mathcal{F}$, $\mathcal{G}$ and $\pi_*\mathcal{G}$
over $S'$ are all equivalent (this uses that $X'$, $Z'$, $Y'$, and
$S'$ are all affine). Some omitted topological arguments (compare
More on Morphisms,
Lemma \ref{more-morphisms-lemma-finite-morphism-single-point-in-fibre})
regarding affine neighbourhoods now show that
(4) $\Leftrightarrow$ (2) $\Leftrightarrow$ (3).

\medskip\noindent
To prove the equivalence of (a), (b), (c) consider the commutative diagram
of local ring maps
$$
\xymatrix{
\mathcal{O}_{X', x'} \ar[r]_\iota &
\mathcal{O}_{Z', z'} &
\mathcal{O}_{Y', y'} \ar[l]^\alpha &
\mathcal{O}_{S', s'} \ar[l]^\beta \\
\mathcal{O}_{X, x} \ar[u]^\gamma & & &
\mathcal{O}_{S, s} \ar[lll]_\varphi \ar[u]_\epsilon
}
$$
We will use
Lemma \ref{lemma-etale-flat-up-down-local-ring}
to equate flatness over $\mathcal{O}_{S, s}$ and $\mathcal{O}_{S', s'}$
without further mention.
The map $\gamma$ is faithfully flat. Hence
$\mathcal{F}_x$ is flat over $\mathcal{O}_{S, s}$
if and only if $g^*\mathcal{F}_{x'}$ is flat over
$\mathcal{O}_{S', s'}$, see
Algebra, Lemma \ref{algebra-lemma-flatness-descends-more-general}.
As $\mathcal{O}_{S', s'}$-modules the modules
$g^*\mathcal{F}_{x'}$, $\mathcal{G}_{z'}$, and
$\pi_*\mathcal{G}_{y'}$ are all isomorphic, see
More on Morphisms,
Lemma \ref{more-morphisms-lemma-finite-morphism-single-point-in-fibre}.
This finishes the proof.
\end{proof}









\section{One step d\'evissage}
\label{section-one-step-devissage}

\noindent
In this section we explain what is a one step d\'evissage of a
module. A one step d\'evissage exist \'etale locally on base and target.
We discuss base change, Zariski shrinking and \'etale localization of
a one step d\'evissage.

\begin{definition}
\label{definition-one-step-devissage}
Let $S$ be a scheme.
Let $X$ be locally of finite type over $S$.
Let $\mathcal{F}$ be a quasi-coherent $\mathcal{O}_X$-module of finite type.
Let $s \in S$ be a point.
A {\it one step d\'evissage of $\mathcal{F}/X/S$ over $s$}
is given by morphisms of schemes over $S$
$$
\xymatrix{
X & Z \ar[l]_i \ar[r]^\pi & Y
}
$$
and a quasi-coherent $\mathcal{O}_Z$-module $\mathcal{G}$ of finite type
such that
\begin{enumerate}
\item $X$, $S$, $Z$ and $Y$ are affine,
\item $i$ is a closed immersion of finite presentation,
\item $\mathcal{F} \cong i_*\mathcal{G}$,
\item $\pi$ is finite, and
\item the structure morphism $Y \to S$ is smooth with
geometrically irreducible fibres of
dimension $\dim(\text{Supp}(\mathcal{F}_s))$.
\end{enumerate}
In this case we say $(Z, Y, i, \pi, \mathcal{G})$ is a one step
d\'evissage of $\mathcal{F}/X/S$ over $s$.
\end{definition}

\noindent
Note that such a one step d\'evissage can only exist if $X$ and $S$
are affine. In the definition above we only require $X$ to be
(locally) of finite type over $S$ and we continue working in this
setting below. In \cite{GruRay} the authors use consistently the setup
where $X \to S$ is locally of finite presentation and $\mathcal{F}$
quasi-coherent $\mathcal{O}_X$-module of finite type. The advantage
of this choice is that it ``makes sense'' to ask for $\mathcal{F}$ to
be of finite presentation as an $\mathcal{O}_X$-module, whereas in our
setting it ``does not make sense''. Please see
More on Morphisms, Section
\ref{more-morphisms-section-finite-type-finite-presentation}
for a discussion; the observations made there show that in our setup
we may consider the condition of $\mathcal{F}$ being ``locally of finite
presentation relative to $S$'', and we could work consistently with this
notion. Instead however, we will rely on the results of
Lemma \ref{lemma-devissage-finite-presentation}
and the observations in
Remark \ref{remark-finite-presentation}
to deal with this issue in an ad hoc fashion whenever it comes up.

\begin{definition}
\label{definition-one-step-devissage-at-x}
Let $S$ be a scheme.
Let $X$ be locally of finite type over $S$.
Let $\mathcal{F}$ be a quasi-coherent $\mathcal{O}_X$-module of finite type.
Let $x \in X$ be a point with image $s$ in $S$.
A {\it one step d\'evissage of $\mathcal{F}/X/S$ at $x$}
is a system $(Z, Y, i, \pi, \mathcal{G}, z, y)$, where
$(Z, Y, i, \pi, \mathcal{G})$ is a one step d\'evissage of
$\mathcal{F}/X/S$ over $s$ and
\begin{enumerate}
\item $\dim_x(\text{Supp}(\mathcal{F}_s)) = \dim(\text{Supp}(\mathcal{F}_s))$,
\item $z \in Z$ is a point with $i(z) = x$ and $\pi(z) = y$,
\item we have $\pi^{-1}(\{y\}) = \{z\}$,
\item the extension $\kappa(y)/\kappa(s)$ is purely
transcendental.
\end{enumerate}
\end{definition}

\noindent
A one step d\'evissage of $\mathcal{F}/X/S$ at $x$ can only exist if
$X$ and $S$ are affine. Condition (1) assures us that $Y \to S$ has
relative dimension equal to $\dim_x(\text{Supp}(\mathcal{F}_s))$
via condition (5) of
Definition \ref{definition-one-step-devissage}.

\begin{lemma}
\label{lemma-elementary-devissage-variant}
Let $f : X \to S$ be morphism of schemes which is locally of finite type.
Let $\mathcal{F}$ be a finite type quasi-coherent $\mathcal{O}_X$-module.
Let $x \in X$ with image $s = f(x)$ in $S$.
Then there exists a commutative diagram of pointed schemes
$$
\xymatrix{
(X, x) \ar[d]_f & (X', x') \ar[l]^g \ar[d] \\
(S, s) & (S', s') \ar[l] \\
}
$$
such that $(S', s') \to (S, s)$ and $(X', x') \to (X, x)$
are elementary \'etale neighbourhoods, and such that
$g^*\mathcal{F}/X'/S'$ has a one step d\'evissage at $x'$.
\end{lemma}

\begin{proof}
This is immediate from
Definition \ref{definition-one-step-devissage-at-x}
and
Lemma \ref{lemma-elementary-devissage}.
\end{proof}

\begin{lemma}
\label{lemma-base-change-one-step}
Let $S$, $X$, $\mathcal{F}$, $s$ be as in
Definition \ref{definition-one-step-devissage}.
Let $(Z, Y, i, \pi, \mathcal{G})$ be a one step d\'evissage
of $\mathcal{F}/X/S$ over $s$.
Let $(S', s') \to (S, s)$ be any morphism of pointed schemes.
Given this data let $X', Z', Y', i', \pi'$ be the base
changes of $X, Z, Y, i, \pi$ via $S' \to S$.
Let $\mathcal{F}'$ be the pullback of $\mathcal{F}$ to $X'$
and let $\mathcal{G}'$ be the pullback of $\mathcal{G}$ to $Z'$.
If $S'$ is affine, then $(Z', Y', i', \pi', \mathcal{G}')$
is a one step d\'evissage of $\mathcal{F}'/X'/S'$ over $s'$.
\end{lemma}

\begin{proof}
Fibre products of affines are affine, see
Schemes, Lemma \ref{schemes-lemma-fibre-product-affines}.
Base change preserves
closed immersions,
morphisms of finite presentation,
finite morphisms,
smooth morphisms,
morphisms with geometrically irreducible fibres, and
morphisms of relative dimension $n$, see
Morphisms, Lemmas \ref{morphisms-lemma-base-change-closed-immersion},
\ref{morphisms-lemma-base-change-finite-presentation},
\ref{morphisms-lemma-base-change-finite},
\ref{morphisms-lemma-base-change-smooth},
\ref{morphisms-lemma-base-change-relative-dimension-d}, and
More on Morphisms, Lemma
\ref{more-morphisms-lemma-base-change-fibres-geometrically-irreducible}.
We have $i'_*\mathcal{G}' \cong \mathcal{F}'$ because pushforward
along the finite morphism $i$ commutes with base change, see
Cohomology of Schemes, Lemma \ref{coherent-lemma-affine-base-change}.
We have
$\dim(\text{Supp}(\mathcal{F}_s)) = \dim(\text{Supp}(\mathcal{F}'_{s'}))$
by
Morphisms, Lemma \ref{morphisms-lemma-dimension-fibre-after-base-change}
because
$$
\text{Supp}(\mathcal{F}_s) \times_s s' = \text{Supp}(\mathcal{F}'_{s'}).
$$
This proves the lemma.
\end{proof}

\begin{lemma}
\label{lemma-base-change-one-step-at-x}
Let $S$, $X$, $\mathcal{F}$, $x$, $s$ be as in
Definition \ref{definition-one-step-devissage-at-x}.
Let $(Z, Y, i, \pi, \mathcal{G}, z, y)$ be a one step d\'evissage
of $\mathcal{F}/X/S$ at $x$.
Let $(S', s') \to (S, s)$ be a morphism of pointed schemes
which induces an isomorphism $\kappa(s) = \kappa(s')$.
Let $(Z', Y', i', \pi', \mathcal{G}')$ be as constructed in
Lemma \ref{lemma-base-change-one-step}
and let $x' \in X'$ (resp.\ $z' \in Z'$, $y' \in Y'$) be the
unique point mapping to both $x \in X$ (resp.\ $z \in Z$, $y \in Y$)
and $s' \in S'$.
If $S'$ is affine, then $(Z', Y', i', \pi', \mathcal{G}', z', y')$
is a one step d\'evissage of $\mathcal{F}'/X'/S'$ at $x'$.
\end{lemma}

\begin{proof}
By
Lemma \ref{lemma-base-change-one-step}
$(Z', Y', i', \pi', \mathcal{G}')$ is a one step d\'evissage of
$\mathcal{F}'/X'/S'$ over $s'$. Properties (1) -- (4) of
Definition \ref{definition-one-step-devissage-at-x}
hold for $(Z', Y', i', \pi', \mathcal{G}', z', y')$
as the assumption that $\kappa(s) = \kappa(s')$ insures that the fibres
$X'_{s'}$, $Z'_{s'}$, and $Y'_{s'}$ are isomorphic to
$X_s$, $Z_s$, and $Y_s$.
\end{proof}

\begin{definition}
\label{definition-shrink}
Let $S$, $X$, $\mathcal{F}$, $x$, $s$ be as in
Definition \ref{definition-one-step-devissage-at-x}.
Let $(Z, Y, i, \pi, \mathcal{G}, z, y)$ be a one step d\'evissage
of $\mathcal{F}/X/S$ at $x$. Let us define a
{\it standard shrinking} of this situation to be
given by standard opens $S' \subset S$, $X' \subset X$, $Z' \subset Z$,
and $Y' \subset Y$ such that $s \in S'$, $x \in X'$, $z \in Z'$, and
$y \in Y'$ and such that
$$
(Z', Y', i|_{Z'}, \pi|_{Z'}, \mathcal{G}|_{Z'}, z, y)
$$
is a one step d\'evissage of $\mathcal{F}|_{X'}/X'/S'$ at $x$.
\end{definition}

\begin{lemma}
\label{lemma-shrink}
With assumption and notation as in
Definition \ref{definition-shrink}
we have:
\begin{enumerate}
\item
\label{item-shrink-base}
If $S' \subset S$ is a standard open neighbourhood of $s$, then
setting $X' = X_{S'}$, $Z' = Z_{S'}$ and $Y' = Y_{S'}$ we obtain a
standard shrinking.
\item
\label{item-shrink-on-Y}
Let $W \subset Y$ be a standard open neighbourhood of $y$.
Then there exists a standard shrinking with $Y' = W \times_S S'$.
\item
\label{item-shrink-on-X}
Let $U \subset X$ be an open neighbourhood of $x$.
Then there exists a standard shrinking with $X' \subset U$.
\end{enumerate}
\end{lemma}

\begin{proof}
Part (1) is immediate from
Lemma \ref{lemma-base-change-one-step-at-x}
and the fact that the inverse image of a standard open under a morphism
of affine schemes is a standard open, see
Algebra, Lemma \ref{algebra-lemma-spec-functorial}.

\medskip\noindent
Let $W \subset Y$ as in (2). Because $Y \to S$ is smooth it is open, see
Morphisms, Lemma \ref{morphisms-lemma-smooth-open}.
Hence we can find a standard open neighbourhood $S'$ of $s$
contained in the image of $W$. Then the fibres of $W_{S'} \to S'$
are nonempty open subschemes of the fibres of $Y \to S$ over $S'$
and hence geometrically irreducible too. Setting $Y' = W_{S'}$
and $Z' = \pi^{-1}(Y')$ we see that $Z' \subset Z$ is a standard open
neighbourhood of $z$. Let $\overline{h} \in \Gamma(Z, \mathcal{O}_Z)$
be a function such that $Z' = D(\overline{h})$. As $i : Z \to X$
is a closed immersion, we can find a function $h \in \Gamma(X, \mathcal{O}_X)$
such that $i^\sharp(h) = \overline{h}$. Take $X' = D(h) \subset X$.
In this way we obtain a standard shrinking as in (2).

\medskip\noindent
Let $U \subset X$ be as in (3). We may after shrinking $U$ assume that
$U$ is a standard open. By
More on Morphisms,
Lemma \ref{more-morphisms-lemma-finite-morphism-single-point-in-fibre}
there exists a standard open $W \subset Y$ neighbourhood of $y$ such
that $\pi^{-1}(W) \subset i^{-1}(U)$. Apply (2) to get a standard
shrinking $X', S', Z', Y'$ with $Y' = W_{S'}$. Since
$Z' \subset \pi^{-1}(W) \subset i^{-1}(U)$ we may replace $X'$ by
$X' \cap U$ (still a standard open as $U$ is also standard open)
without violating any of the conditions defining a standard shrinking.
Hence we win.
\end{proof}

\begin{lemma}
\label{lemma-elementary-etale-neighbourhood}
Let $S$, $X$, $\mathcal{F}$, $x$, $s$ be as in
Definition \ref{definition-one-step-devissage-at-x}.
Let $(Z, Y, i, \pi, \mathcal{G}, z, y)$ be a one step d\'evissage
of $\mathcal{F}/X/S$ at $x$. Let
$$
\xymatrix{
(Y, y) \ar[d] & (Y', y') \ar[l] \ar[d] \\
(S, s) & (S', s') \ar[l]
}
$$
be a commutative diagram of pointed schemes such that the horizontal
arrows are elementary \'etale neighbourhoods. Then there exists
a commutative diagram
$$
\xymatrix{
& & (X'', x'') \ar[lld] \ar[d] & (Z'', z'') \ar[l] \ar[lld] \ar[d] \\
(X, x) \ar[d] & (Z, z) \ar[l] \ar[d] &
(S'', s'') \ar[lld] & (Y'', y'') \ar[lld] \ar[l] \\
(S, s) & (Y, y) \ar[l]
}
$$
of pointed schemes with the following properties:
\begin{enumerate}
\item $(S'', s'') \to (S', s')$ is an elementary \'etale neighbourhood and
the morphism $S'' \to S$ is the composition $S'' \to S' \to S$,
\item $Y''$ is an open subscheme of $Y' \times_{S'} S''$,
\item $Z'' = Z \times_Y Y''$,
\item $(X'', x'') \to (X, x)$ is an elementary \'etale neighbourhood, and
\item $(Z'', Y'', i'', \pi'', \mathcal{G}'', z'', y'')$ is a one step
d\'evissage at $x''$ of the sheaf $\mathcal{F}''$.
\end{enumerate}
Here $\mathcal{F}''$ (resp.\ $\mathcal{G}''$) is the pullback of
$\mathcal{F}$ (resp.\ $\mathcal{G}$) via the morphism $X'' \to X$
(resp.\ $Z'' \to Z$) and $i'' : Z'' \to X''$ and $\pi'' : Z'' \to Y''$
are as in the diagram.
\end{lemma}

\begin{proof}
Let $(S'', s'') \to (S', s')$ be any elementary \'etale neighbourhood
with $S''$ affine. Let $Y'' \subset Y' \times_{S'} S''$ be any affine
open neighbourhood containing the point $y'' = (y', s'')$. Then we
obtain an affine $(Z'', z'')$ by (3). Moreover $Z_{S''} \to X_{S''}$
is a closed immersion and $Z'' \to Z_{S''}$ is an \'etale
morphism. Hence
Lemma \ref{lemma-lift-etale}
applies and we can find an \'etale morphism $X'' \to X_{S'}$ of affines
such that $Z'' \cong X'' \times_{X_{S'}} Z_{S'}$. Denote $i'' : Z'' \to X''$
the corresponding closed immersion. Setting $x'' = i''(z'')$ we obtain a
commutative diagram as in the lemma.
Properties (1), (2), (3), and (4) hold by construction.
Thus it suffices to show that (5) holds for a suitable choice of
$(S'', s'') \to (S', s')$ and $Y''$.

\medskip\noindent
We first list those properties which hold for any choice of
$(S'', s'') \to (S', s')$ and $Y''$ as in the first paragraph.
As we have $Z'' = X'' \times_X Z$ by construction we see that
$i''_*\mathcal{G}'' = \mathcal{F}''$ (with notation as in the
statement of the lemma), see
Cohomology of Schemes, Lemma \ref{coherent-lemma-affine-base-change}.
Set $n = \dim(\text{Supp}(\mathcal{F}_s)) = \dim_x(\text{Supp}(\mathcal{F}_s))$.
The morphism $Y'' \to S''$ is smooth of relative dimension $n$
(because $Y' \to S'$ is smooth of relative dimension $n$
as the composition $Y' \to Y_{S'} \to S'$ of an \'etale and
smooth morphism of relative dimension $n$ and because base change
preserves smooth morphisms of relative dimension $n$).
We have $\kappa(y'') = \kappa(y)$ and $\kappa(s) = \kappa(s'')$
hence $\kappa(y'')$ is a purely transcendental extension of $\kappa(s'')$.
The morphism of fibres $X''_{s''} \to X_s$ is an \'etale morphism of affine
schemes over $\kappa(s) = \kappa(s'')$ mapping the point $x''$ to the
point $x$ and pulling back $\mathcal{F}_s$ to $\mathcal{F}''_{s''}$.
Hence
$$
\dim(\text{Supp}(\mathcal{F}''_{s''})) =
\dim(\text{Supp}(\mathcal{F}_s)) = n =
\dim_x(\text{Supp}(\mathcal{F}_s)) =
\dim_{x''}(\text{Supp}(\mathcal{F}''_{s''}))
$$
because dimension is invariant under \'etale localization, see
Descent, Lemma \ref{descent-lemma-dimension-at-point-local}.
As $\pi'' : Z'' \to Y''$ is the base change of $\pi$ we see that
$\pi''$ is finite and as $\kappa(y) = \kappa(y'')$ we see that
$\pi^{-1}(\{y''\}) = \{z''\}$.

\medskip\noindent
At this point we have verified all the conditions of
Definition \ref{definition-one-step-devissage}
except we have not verified that $Y'' \to S''$ has geometrically
irreducible fibres. Of course in general this is not going to be
true, and it is at this point that we will use that
$\kappa(s) \subset \kappa(y)$ is purely transcendental. Namely,
let $T \subset Y'_{s'}$ be the irreducible component of
$Y'_{s'}$ containing $y' = (y, s')$. Note that $T$ is an open subscheme
of $Y'_{s'}$ as this is a smooth scheme over $\kappa(s')$. By
Varieties,
Lemma \ref{varieties-lemma-geometrically-connected-if-connected-and-point}
we see that $T$ is geometrically connected because $\kappa(s') = \kappa(s)$
is algebraically closed in $\kappa(y') = \kappa(y)$.
As $T$ is smooth we see that $T$ is geometrically irreducible. Hence
More on Morphisms,
Lemma \ref{more-morphisms-lemma-normal-morphism-irreducible}
applies and we can find an elementary \'etale morphism
$(S'', s'') \to (S', s')$ and an affine open $Y'' \subset Y'_{S''}$
such that all fibres of $Y'' \to S''$ are geometrically irreducible
and such that $T = Y''_{s''}$. After shrinking (first $Y''$ and then $S''$)
we may assume that both $Y''$ and $S''$ are affine.
This finishes the proof of the lemma.
\end{proof}

\begin{lemma}
\label{lemma-existence-alpha}
Let $S$, $X$, $\mathcal{F}$, $s$ be as in
Definition \ref{definition-one-step-devissage}.
Let $(Z, Y, i, \pi, \mathcal{G})$ be a one step d\'evissage
of $\mathcal{F}/X/S$ over $s$.
Let $\xi \in Y_s$ be the (unique) generic point.
Then there exists an integer $r > 0$ and an $\mathcal{O}_Y$-module map
$$
\alpha : \mathcal{O}_Y^{\oplus r} \longrightarrow \pi_*\mathcal{G}
$$
such that
$$
\alpha :
\kappa(\xi)^{\oplus r}
\longrightarrow
(\pi_*\mathcal{G})_\xi \otimes_{\mathcal{O}_{Y, \xi}} \kappa(\xi)
$$
is an isomorphism. Moreover, in this case we have
$$
\dim(\text{Supp}(\Coker(\alpha)_s)) < \dim(\text{Supp}(\mathcal{F}_s)).
$$
\end{lemma}

\begin{proof}
By assumption the schemes $S$ and $Y$ are affine.
Write $S = \Spec(A)$ and $Y = \Spec(B)$.
As $\pi$ is finite the $\mathcal{O}_Y$-module $\pi_*\mathcal{G}$
is a finite type quasi-coherent $\mathcal{O}_Y$-module.
Hence $\pi_*\mathcal{G} = \widetilde{N}$ for some finite $B$-module $N$.
Let $\mathfrak p \subset B$ be the prime ideal corresponding to $\xi$.
To obtain $\alpha$ set
$r = \dim_{\kappa(\mathfrak p)} N \otimes_B \kappa(\mathfrak p)$
and pick $x_1, \ldots, x_r \in N$ which form a basis of
$N \otimes_B \kappa(\mathfrak p)$. Take $\alpha : B^{\oplus r} \to N$
to be the map given by the formula $\alpha(b_1, \ldots, b_r) = \sum b_ix_i$.
It is clear that
$\alpha : \kappa(\mathfrak p)^{\oplus r} \to N \otimes_B \kappa(\mathfrak p)$
is an isomorphism as desired. Finally, suppose $\alpha$ is any map with this
property. Then $N' = \Coker(\alpha)$ is a finite $B$-module
such that $N' \otimes \kappa(\mathfrak p) = 0$. By Nakayama's lemma
(Algebra, Lemma \ref{algebra-lemma-NAK})
we see that $N'_{\mathfrak p} = 0$. Since the fibre $Y_s$ is
geometrically irreducible of dimension $n$ with generic point $\xi$
and since we have just seen that $\xi$ is not in the support of
$\Coker(\alpha)$ the last assertion of the lemma holds.
\end{proof}


\section{Complete d\'evissage}
\label{section-complete-devissage}

\noindent
In this section we explain what is a complete d\'evissage of a
module and prove that such exist. The material in this
section is mainly bookkeeping.

\begin{definition}
\label{definition-complete-devissage}
Let $S$ be a scheme.
Let $X$ be locally of finite type over $S$.
Let $\mathcal{F}$ be a quasi-coherent $\mathcal{O}_X$-module of finite type.
Let $s \in S$ be a point.
A {\it complete d\'evissage of $\mathcal{F}/X/S$ over $s$} is given by a
diagram
$$
\xymatrix{
X & Z_1 \ar[l]^{i_1} \ar[d]^{\pi_1} \\
& Y_1 & Z_2 \ar[l]^{i_2} \ar[d]^{\pi_2} \\
& & Y_2 & Z_3 \ar[l] \ar[d] \\
& & & ... & ... \ar[l] \ar[d] \\
& & & & Y_n
}
$$
of schemes over $S$, finite type quasi-coherent $\mathcal{O}_{Z_k}$-modules
$\mathcal{G}_k$, and $\mathcal{O}_{Y_k}$-module maps
$$
\alpha_k :
\mathcal{O}_{Y_k}^{\oplus r_k}
\longrightarrow
\pi_{k, *}\mathcal{G}_k,
\quad
k = 1, \ldots, n
$$
satisfying the following properties:
\begin{enumerate}
\item $(Z_1, Y_1, i_1, \pi_1, \mathcal{G}_1)$ is a one step
d\'evissage of $\mathcal{F}/X/S$ over $s$,
\item the map $\alpha_k$ induces an isomorphism
$$
\kappa(\xi_k)^{\oplus r_k} \longrightarrow
(\pi_{k, *}\mathcal{G}_k)_{\xi_k}
\otimes_{\mathcal{O}_{Y_k, \xi_k}} \kappa(\xi_k)
$$
where $\xi_k \in (Y_k)_s$ is the unique generic point,
\item for $k = 2, \ldots, n$ the system
$(Z_k, Y_k, i_k, \pi_k, \mathcal{G}_k)$
is a one step d\'evissage of $\Coker(\alpha_{k - 1})/Y_{k - 1}/S$
over $s$,
\item $\Coker(\alpha_n) = 0$.
\end{enumerate}
In this case we say that
$(Z_k, Y_k, i_k, \pi_k, \mathcal{G}_k, \alpha_k)_{k = 1, \ldots, n}$
is a complete d\'evissage of $\mathcal{F}/X/S$ over $s$.
\end{definition}

\begin{definition}
\label{definition-complete-devissage-at-x}
Let $S$ be a scheme.
Let $X$ be locally of finite type over $S$.
Let $\mathcal{F}$ be a quasi-coherent $\mathcal{O}_X$-module of finite type.
Let $x \in X$ be a point with image $s \in S$.
A {\it complete d\'evissage of $\mathcal{F}/X/S$ at $x$} is given by a
system
$$
(Z_k, Y_k, i_k, \pi_k, \mathcal{G}_k, \alpha_k, z_k, y_k)_{k = 1, \ldots, n}
$$
such that $(Z_k, Y_k, i_k, \pi_k, \mathcal{G}_k, \alpha_k)$ is a
complete d\'evissage of $\mathcal{F}/X/S$ over $s$, and such that
\begin{enumerate}
\item $(Z_1, Y_1, i_1, \pi_1, \mathcal{G}_1, z_1, y_1)$ is a one step
d\'evissage of $\mathcal{F}/X/S$ at $x$,
\item for $k = 2, \ldots, n$ the system
$(Z_k, Y_k, i_k, \pi_k, \mathcal{G}_k, z_k, y_k)$
is a one step d\'evissage of $\Coker(\alpha_{k - 1})/Y_{k - 1}/S$
at $y_{k - 1}$.
\end{enumerate}
\end{definition}

\noindent
Again we remark that a complete d\'evissage can only exist if $X$ and
$S$ are affine.

\begin{lemma}
\label{lemma-base-change-complete}
Let $S$, $X$, $\mathcal{F}$, $s$ be as in
Definition \ref{definition-complete-devissage}.
Let $(S', s') \to (S, s)$ be any morphism of pointed schemes.
Let $(Z_k, Y_k, i_k, \pi_k, \mathcal{G}_k, \alpha_k)_{k = 1, \ldots, n}$
be a complete d\'evissage of $\mathcal{F}/X/S$ over $s$.
Given this data let $X', Z'_k, Y'_k, i'_k, \pi'_k$ be the base
changes of $X, Z_k, Y_k, i_k, \pi_k$ via $S' \to S$.
Let $\mathcal{F}'$ be the pullback of $\mathcal{F}$ to $X'$
and let $\mathcal{G}'_k$ be the pullback of $\mathcal{G}_k$ to $Z'_k$.
Let $\alpha'_k$ be the pullback of $\alpha_k$ to $Y'_k$.
If $S'$ is affine, then
$(Z'_k, Y'_k, i'_k, \pi'_k, \mathcal{G}'_k, \alpha'_k)_{k = 1, \ldots, n}$
is a complete d\'evissage of $\mathcal{F}'/X'/S'$ over $s'$.
\end{lemma}

\begin{proof}
By
Lemma \ref{lemma-base-change-one-step}
we know that the base change of a one step d\'evissage is a one step
d\'evissage. Hence it suffices to prove that formation of
$\Coker(\alpha_k)$ commutes with base change and that
condition (2) of
Definition \ref{definition-complete-devissage}
is preserved by base change. The first is true as
$\pi'_{k, *}\mathcal{G}'_k$ is the pullback of
$\pi_{k, *}\mathcal{G}_k$ (by
Cohomology of Schemes, Lemma \ref{coherent-lemma-affine-base-change})
and because $\otimes$ is right exact. The second because
by the same token we have
$$
(\pi_{k, *}\mathcal{G}_k)_{\xi_k}
\otimes_{\mathcal{O}_{Y_k, \xi_k}} \kappa(\xi_k)
\otimes_{\kappa(\xi_k)} \kappa(\xi'_k)
\cong
(\pi'_{k, *}\mathcal{G}'_k)_{\xi'_k}
\otimes_{\mathcal{O}_{Y'_k, \xi'_k}} \kappa(\xi'_k)
$$
with obvious notation.
\end{proof}

\begin{lemma}
\label{lemma-base-change-complete-at-x}
Let $S$, $X$, $\mathcal{F}$, $x$, $s$ be as in
Definition \ref{definition-complete-devissage-at-x}.
Let $(S', s') \to (S, s)$ be a morphism of pointed schemes
which induces an isomorphism $\kappa(s) = \kappa(s')$. Let
$(Z_k, Y_k, i_k, \pi_k, \mathcal{G}_k, \alpha_k, z_k, y_k)_{k = 1, \ldots, n}$
be a complete d\'evissage of $\mathcal{F}/X/S$ at $x$.
Let
$(Z'_k, Y'_k, i'_k, \pi'_k, \mathcal{G}'_k, \alpha'_k)_{k = 1, \ldots, n}$
be as constructed in
Lemma \ref{lemma-base-change-complete}
and let $x' \in X'$ (resp.\ $z'_k \in Z'$, $y'_k \in Y'$) be the
unique point mapping to both $x \in X$ (resp.\ $z_k \in Z_k$, $y_k \in Y_k$)
and $s' \in S'$.
If $S'$ is affine, then
$(Z'_k, Y'_k, i'_k, \pi'_k, \mathcal{G}'_k, \alpha'_k,
z'_k, y'_k)_{k = 1, \ldots, n}$
is a complete d\'evissage of $\mathcal{F}'/X'/S'$ at $x'$.
\end{lemma}

\begin{proof}
Combine
Lemma \ref{lemma-base-change-complete}
and
Lemma \ref{lemma-base-change-one-step-at-x}.
\end{proof}

\begin{definition}
\label{definition-shrink-complete}
Let $S$, $X$, $\mathcal{F}$, $x$, $s$ be as in
Definition \ref{definition-complete-devissage-at-x}.
Consider a complete d\'evissage
$(Z_k, Y_k, i_k, \pi_k, \mathcal{G}_k, \alpha_k, z_k, y_k)_{k = 1, \ldots, n}$
of $\mathcal{F}/X/S$ at $x$. Let us define a
{\it standard shrinking} of this situation to be
given by standard opens $S' \subset S$, $X' \subset X$,
$Z'_k \subset Z_k$, and $Y'_k \subset Y_k$ such that $s_k \in S'$,
$x_k \in X'$, $z_k \in Z'$, and $y_k \in Y'$ and such that
$$
(Z'_k, Y'_k, i'_k, \pi'_k,
\mathcal{G}'_k, \alpha'_k, z_k, y_k)_{k = 1, \ldots, n}
$$
is a one step d\'evissage of $\mathcal{F}'/X'/S'$ at $x$ where
$\mathcal{G}'_k = \mathcal{G}_k|_{Z'_k}$ and
$\mathcal{F}' = \mathcal{F}|_{X'}$.
\end{definition}

\begin{lemma}
\label{lemma-shrink-complete}
With assumption and notation as in
Definition \ref{definition-shrink-complete}
we have:
\begin{enumerate}
\item
\label{item-shrink-base-complete}
If $S' \subset S$ is a standard open neighbourhood of $s$, then
setting $X' = X_{S'}$, $Z'_k = Z_{S'}$ and $Y'_k = Y_{S'}$ we obtain a
standard shrinking.
\item
\label{item-shrink-on-Y-complete}
Let $W \subset Y_n$ be a standard open neighbourhood of $y$.
Then there exists a standard shrinking with $Y'_n = W \times_S S'$.
\item
\label{item-shrink-on-X-complete}
Let $U \subset X$ be an open neighbourhood of $x$.
Then there exists a standard shrinking with $X' \subset U$.
\end{enumerate}
\end{lemma}

\begin{proof}
Part (1) is immediate from
Lemmas \ref{lemma-base-change-complete-at-x} and
\ref{lemma-shrink}.

\medskip\noindent
Proof of (2). For convenience denote $X = Y_0$. We apply
Lemma \ref{lemma-shrink} (\ref{item-shrink-on-Y})
to find a standard shrinking
$S', Y'_{n - 1}, Z'_n, Y'_n$
of the one step d\'evissage of $\Coker(\alpha_{n - 1})/Y_{n - 1}/S$
at $y_{n - 1}$ with $Y'_n = W \times_S S'$. We may repeat this procedure
and find a standard shrinking
$S'', Y''_{n - 2}, Z''_{n - 1}, Y''_{n - 1}$
of the one step d\'evissage of $\Coker(\alpha_{n - 2})/Y_{n - 2}/S$
at $y_{n - 2}$ with $Y''_{n - 1} = Y'_{n - 1} \times_S S''$.
We may continue in this manner until we obtain
$S^{(n)}, Y^{(n)}_0, Z^{(n)}_1, Y^{(n)}_1$.
At this point it is clear that we obtain our desired standard shrinking
by taking $S^{(n)}$, $X^{(n)}$, $Z_k^{(n - k)} \times_S S^{(n)}$, and
$Y_k^{(n - k)} \times_S S^{(n)}$ with the desired property.

\medskip\noindent
Proof of (3). We use induction on the length of the complete
d\'evissage. First we apply
Lemma \ref{lemma-shrink} (\ref{item-shrink-on-X})
to find a standard shrinking
$S', X', Z'_1, Y'_1$
of the one step d\'evissage of $\mathcal{F}/X/S$ at $x$
with $X' \subset U$. If $n = 1$, then we are done.
If $n > 1$, then by induction we can find a standard shrinking
$S''$, $Y''_1$, $Z''_k$, and $Y''_k$ of the complete d\'evissage
$(Z_k, Y_k, i_k, \pi_k, \mathcal{G}_k, \alpha_k, z_k, y_k)_{k = 2, \ldots, n}$
of $\Coker(\alpha_1)/Y_1/S$ at $x$ such that
$Y''_1 \subset Y'_1$. Using
Lemma \ref{lemma-shrink} (\ref{item-shrink-on-Y})
we can find $S''' \subset S'$, $X''' \subset X'$, $Z'''_1$ and
$Y'''_1 = Y''_1 \times_S S'''$ which is a standard shrinking.
The solution to our problem is to take
$$
S''', X''', Z'''_1, Y'''_1, Z''_2 \times_S S''',
Y''_2 \times_S S''', \ldots, Z''_n \times_S S''', Y''_n \times_S S'''
$$
This ends the proof of the lemma.
\end{proof}

\begin{proposition}
\label{proposition-existence-complete-at-x}
Let $S$ be a scheme.
Let $X$ be locally of finite type over $S$.
Let $x \in X$ be a point with image $s \in S$.
There exists a commutative diagram
$$
\xymatrix{
(X, x) \ar[d] & (X', x') \ar[l]^g \ar[d] \\
(S, s) & (S', s') \ar[l]
}
$$
of pointed schemes such that the horizontal
arrows are elementary \'etale neighbourhoods
and such that $g^*\mathcal{F}/X'/S'$ has a complete
d\'evissage at $x$.
\end{proposition}

\begin{proof}
We prove this by induction on the integer
$d = \dim_x(\text{Supp}(\mathcal{F}_s))$.
By
Lemma \ref{lemma-elementary-devissage-variant}
there exists a diagram
$$
\xymatrix{
(X, x) \ar[d] & (X', x') \ar[l]^g \ar[d] \\
(S, s) & (S', s') \ar[l]
}
$$
of pointed schemes such that the horizontal
arrows are elementary \'etale neighbourhoods
and such that $g^*\mathcal{F}/X'/S'$ has a one step d\'evissage at $x'$.
The local nature of the problem implies that we may replace
$(X, x) \to (S, s)$ by $(X', x') \to (S', s')$. Thus after doing so
we may assume that there exists a one step d\'evissage
$(Z_1, Y_1, i_1, \pi_1, \mathcal{G}_1)$ of $\mathcal{F}/X/S$ at $x$.

\medskip\noindent
We apply
Lemma \ref{lemma-existence-alpha}
to find a map
$$
\alpha_1 :
\mathcal{O}_{Y_1}^{\oplus r_1}
\longrightarrow
\pi_{1, *}\mathcal{G}_1
$$
which induces an isomorphism of vector spaces over $\kappa(\xi_1)$
where $\xi_1 \in Y_1$ is the unique generic point of the fibre of
$Y_1$ over $s$. Moreover
$\dim_{y_1}(\text{Supp}(\Coker(\alpha_1)_s)) < d$.
It may happen that the stalk of $\Coker(\alpha_1)_s$
at $y_1$ is zero. In this case we may shrink $Y_1$ by
Lemma \ref{lemma-shrink} (\ref{item-shrink-on-Y})
and assume that $\Coker(\alpha_1) = 0$ so we obtain a
complete d\'evissage of length zero.

\medskip\noindent
Assume now that the stalk of $\Coker(\alpha_1)_s$
at $y_1$ is not zero. In this case, by induction, there exists a
commutative diagram
\begin{equation}
\label{equation-overcome-this}
\vcenter{
\xymatrix{
(Y_1, y_1) \ar[d] & (Y'_1, y'_1) \ar[l]^h \ar[d] \\
(S, s) & (S', s') \ar[l]
}
}
\end{equation}
of pointed schemes such that the horizontal
arrows are elementary \'etale neighbourhoods
and such that $h^*\Coker(\alpha_1)/Y'_1/S'$ has a complete
d\'evissage
$$
(Z_k, Y_k, i_k, \pi_k, \mathcal{G}_k, \alpha_k, z_k, y_k)_{k = 2, \ldots, n}
$$
at $y'_1$. (In particular $i_2 : Z_2 \to Y'_1$ is a closed immersion into
$Y'_2$.) At this point we apply
Lemma \ref{lemma-elementary-etale-neighbourhood}
to $S, X, \mathcal{F}, x, s$, the system
$(Z_1, Y_1, i_1, \pi_1, \mathcal{G}_1)$ and
diagram (\ref{equation-overcome-this}). We obtain a diagram
$$
\xymatrix{
& & (X'', x'') \ar[lld] \ar[d] & (Z''_1, z''_1) \ar[l] \ar[lld] \ar[d] \\
(X, x) \ar[d] & (Z_1, z_1) \ar[l] \ar[d] &
(S'', s'') \ar[lld] & (Y''_1, y''_1) \ar[lld] \ar[l] \\
(S, s) & (Y_1, y_1) \ar[l]
}
$$
with all the properties as listed in the referenced lemma.
In particular $Y''_1 \subset Y'_1 \times_{S'} S''$. Set
$X_1 = Y'_1 \times_{S'} S''$ and let $\mathcal{F}_1$ denote the
pullback of $\Coker(\alpha_1)$. By
Lemma \ref{lemma-base-change-complete-at-x}
the system
\begin{equation}
\label{equation-shrink-this}
(Z_k \times_{S'} S'',
Y_k \times_{S'} S'', i''_k, \pi''_k, \mathcal{G}''_k,
\alpha''_k, z''_k, y''_k)_{k = 2, \ldots, n}
\end{equation}
is a complete d\'evissage of $\mathcal{F}_1$
to $X_1$. Again, the nature of the problem allows
us to replace $(X, x) \to (S, s)$ by $(X'', x'') \to (S'', s'')$.
In this we see that we may assume:
\begin{enumerate}
\item[(a)] There exists a one step d\'evissage
$(Z_1, Y_1, i_1, \pi_1, \mathcal{G}_1)$ of $\mathcal{F}/X/S$ at $x$,
\item[(b)] there exists an $\alpha_1 : \mathcal{O}_{Y_1}^{\oplus r_1}
\to \pi_{1, *}\mathcal{G}_1$ such that $\alpha \otimes \kappa(\xi_1)$
is an isomorphism,
\item[(c)] $Y_1 \subset X_1$ is open, $y_1 = x_1$, and
$\mathcal{F}_1|_{Y_1} \cong \Coker(\alpha_1)$, and
\item[(d)] there exists a complete d\'evissage
$(Z_k, Y_k, i_k, \pi_k, \mathcal{G}_k, \alpha_k, z_k, y_k)_{k = 2, \ldots, n}$
of $\mathcal{F}_1/X_1/S$ at $x_1$.
\end{enumerate}
To finish the proof all we have to do is shrink the one step d\'evissage
and the complete d\'evissage such that they fit together to a complete
d\'evissage. (We suggest the reader do this on their own using
Lemmas \ref{lemma-shrink} and
\ref{lemma-shrink-complete}
instead of reading the proof that follows.) Since $Y_1 \subset X_1$
is an open neighbourhood of $x_1$ we may apply
Lemma \ref{lemma-shrink-complete} (\ref{item-shrink-on-X-complete})
to find a standard shrinking $S', X'_1, Z'_2, Y'_2, \ldots, Y'_n$
of the datum (d) so that $X'_1 \subset Y_1$. Note that $X'_1$ is also
a standard open of the affine scheme $Y_1$. Next, we shrink the datum
(a) as follows: first we shrink the base $S$ to $S'$, see
Lemma \ref{lemma-shrink} (\ref{item-shrink-base}) and then
we shrink the result to $S''$, $X''$, $Z''_1$, $Y''_1$ using
Lemma \ref{lemma-shrink} (\ref{item-shrink-on-Y})
such that eventually $Y''_1 = X'_1 \times_S S''$ and $S'' \subset S'$.
Then we see that
$$
Z''_1, Y''_1, Z'_2 \times_{S'} S'', Y'_2 \times_{S'} S'', \ldots,
Y'_n \times_{S'} S''
$$
gives the complete d\'evissage we were looking for.
\end{proof}

\noindent
Some more bookkeeping gives the following consequence.

\begin{lemma}
\label{lemma-existence-complete}
Let $X \to S$ be a finite type morphism of schemes.
Let $\mathcal{F}$ be a finite type quasi-coherent $\mathcal{O}_X$-module.
Let $s \in S$ be a point.
There exists an elementary \'etale neighbourhood
$(S', s') \to (S, s)$ and \'etale morphisms
$h_i : Y_i \to X_{S'}$, $i = 1, \ldots, n$ such that for each
$i$ there exists a complete d\'evissage of $\mathcal{F}_i/Y_i/S'$ over $s'$,
where $\mathcal{F}_i$ is the pullback of $\mathcal{F}$ to $Y_i$
and such that $X_s = (X_{S'})_{s'} \subset \bigcup h_i(Y_i)$.
\end{lemma}

\begin{proof}
For every point $x \in X_s$ we can find a diagram
$$
\xymatrix{
(X, x) \ar[d] & (X', x') \ar[l]^g \ar[d] \\
(S, s) & (S', s') \ar[l]
}
$$
of pointed schemes such that the horizontal arrows are elementary
\'etale neighbourhoods and such that $g^*\mathcal{F}/X'/S'$ has a
complete d\'evissage at $x'$. As $X \to S$ is of finite type the
fibre $X_s$ is quasi-compact, and since each $g : X' \to X$ as above
is open we can cover $X_s$ by a finite union of $g(X'_{s'})$.
Thus we can find a finite family of such diagrams
$$
\vcenter{
\xymatrix{
(X, x) \ar[d] & (X'_i, x'_i) \ar[l]^{g_i} \ar[d] \\
(S, s) & (S'_i, s'_i) \ar[l]
}
}
\quad i = 1, \ldots, n
$$
such that $X_s = \bigcup g_i(X'_i)$. Set
$S' = S'_1 \times_S \ldots \times_S S'_n$
and let $Y_i = X_i \times_{S'_i} S'$ be the base change of $X'_i$ to $S'$. By
Lemma \ref{lemma-base-change-complete}
we see that the pullback of $\mathcal{F}$ to $Y_i$ has a complete d\'evissage
over $s$ and we win.
\end{proof}



\section{Translation into algebra}
\label{section-translation}

\noindent
It may be useful to spell out algebraically what it means to have a
complete d\'evissage. We introduce the following notion (which is not
that useful so we give it an impossibly long name).

\begin{definition}
\label{definition-elementary-etale-neighbourhood}
Let $R \to S$ be a ring map. Let $\mathfrak q$ be a prime of $S$ lying over
the prime $\mathfrak p$ of $R$. A {\it elementary \'etale localization of
the ring map $R \to S$ at $\mathfrak q$} is given by a commutative diagram
of rings and accompanying primes
$$
\xymatrix{
S \ar[r] & S' \\
R \ar[u] \ar[r] & R' \ar[u]
}
\quad\quad
\xymatrix{
\mathfrak q \ar@{-}[r] & \mathfrak q' \\
\mathfrak p \ar@{-}[u] \ar@{-}[r] & \mathfrak p' \ar@{-}[u]
}
$$
such that $R \to R'$ and $S \to S'$ are \'etale ring maps and
$\kappa(\mathfrak p) = \kappa(\mathfrak p')$ and
$\kappa(\mathfrak q) = \kappa(\mathfrak q')$.
\end{definition}

\begin{definition}
\label{definition-complete-devissage-algebra}
Let $R \to S$ be a finite type ring map.
Let $\mathfrak r$ be a prime of $R$.
Let $N$ be a finite $S$-module.
A {\it complete d\'evissage of $N/S/R$ over $\mathfrak r$}
is given by $R$-algebra maps
$$
\xymatrix{
& A_1 & & A_2 & & ... & & A_n \\
S \ar[ru] & & B_1 \ar[lu] \ar[ru] & & ... \ar[lu] \ar[ru] & &
... \ar[lu] \ar[ru] & & B_n \ar[lu]
}
$$
finite $A_i$-modules $M_i$ and $B_i$-module maps
$\alpha_i : B_i^{\oplus r_i} \to M_i$ such that
\begin{enumerate}
\item $S \to A_1$ is surjective and of finite presentation,
\item $B_i \to A_{i + 1}$ is surjective and of finite presentation,
\item $B_i \to A_i$ is finite,
\item $R \to B_i$ is smooth with geometrically irreducible fibres,
\item $N \cong M_1$ as $S$-modules,
\item $\Coker(\alpha_i) \cong M_{i + 1}$ as $B_i$-modules,
\item $\alpha_i : \kappa(\mathfrak p_i)^{\oplus r_i}
\to M_i \otimes_{B_i} \kappa(\mathfrak p_i)$ is an isomorphism
where $\mathfrak p_i = \mathfrak rB_i$, and
\item $\Coker(\alpha_n) = 0$.
\end{enumerate}
In this situation we say that
$(A_i, B_i, M_i, \alpha_i)_{i = 1, \ldots, n}$
is a complete d\'evissage of $N/S/R$ over $\mathfrak r$.
\end{definition}

\begin{remark}
\label{remark-finite-presentation}
Note that the $R$-algebras $B_i$ for all $i$ and $A_i$ for $i \geq 2$
are of finite presentation over $R$. If $S$ is of finite presentation over
$R$, then it is also the case that $A_1$ is of finite presentation over
$R$. In this case all the ring maps in the complete d\'evissage are of
finite presentation. See
Algebra, Lemma \ref{algebra-lemma-compose-finite-type}.
Still assuming $S$ of finite presentation over $R$
the following are equivalent
\begin{enumerate}
\item $M$ is of finite presentation over $S$,
\item $M_1$ is of finite presentation over $A_1$,
\item $M_1$ is of finite presentation over $B_1$,
\item each $M_i$ is of finite presentation both as an $A_i$-module
and as a $B_i$-module.
\end{enumerate}
The equivalences (1) $\Leftrightarrow$ (2) and (2) $\Leftrightarrow$ (3)
follow from
Algebra, Lemma \ref{algebra-lemma-finite-finitely-presented-extension}.
If $M_1$ is finitely presented, so is $\Coker(\alpha_1)$ (see
Algebra, Lemma \ref{algebra-lemma-extension})
and hence $M_2$, etc.
\end{remark}

\begin{definition}
\label{definition-complete-devissage-at-x-algebra}
Let $R \to S$ be a finite type ring map.
Let $\mathfrak q$ be a prime of $S$ lying over the prime $\mathfrak r$ of $R$.
Let $N$ be a finite $S$-module.
A {\it complete d\'evissage of $N/S/R$ at $\mathfrak q$} is given by a
complete d\'evissage $(A_i, B_i, M_i, \alpha_i)_{i = 1, \ldots, n}$
of $N/S/R$ over $\mathfrak r$ and prime ideals $\mathfrak q_i \subset B_i$
lying over $\mathfrak r$ such that
\begin{enumerate}
\item $\kappa(\mathfrak r) \subset \kappa(\mathfrak q_i)$ is purely
transcendental,
\item there is a unique prime $\mathfrak q'_i \subset A_i$
lying over $\mathfrak q_i \subset B_i$,
\item $\mathfrak q = \mathfrak q'_1 \cap S$ and
$\mathfrak q_i = \mathfrak q'_{i + 1} \cap A_i$,
\item $R \to B_i$ has relative dimension
$\dim_{\mathfrak q_i}(\text{Supp}(M_i \otimes_R \kappa(\mathfrak r)))$.
\end{enumerate}
\end{definition}

\begin{remark}
\label{remark-same-notion}
Let $A \to B$ be a finite type ring map and let $N$ be a finite
$B$-module. Let $\mathfrak q$ be a prime of $B$ lying over the prime
$\mathfrak r$ of $A$. Set $X = \Spec(B)$, $S = \Spec(A)$ and
$\mathcal{F} = \widetilde{N}$ on $X$. Let $x$ be the point corresponding
to $\mathfrak q$ and let $s \in S$ be the point corresponding to
$\mathfrak p$. Then
\begin{enumerate}
\item if there exists a complete d\'evissage of $\mathcal{F}/X/S$
over $s$ then there exists a complete d\'evissage of
$N/B/A$ over $\mathfrak p$, and
\item there exists a complete d\'evissage of $\mathcal{F}/X/S$
at $x$ if and only if there exists a complete d\'evissage of
$N/B/A$ at $\mathfrak q$.
\end{enumerate}
There is just a small twist in that we omitted the condition on
the relative dimension in the formulation of ``a complete d\'evissage of
$N/B/A$ over $\mathfrak p$'' which is why the implication in (1)
only goes in one direction.
The notion of a complete d\'evissage at
$\mathfrak q$ does have this condition built in. In any case we will
only use that existence for $\mathcal{F}/X/S$
implies the existence for $N/B/A$.
\end{remark}

\begin{lemma}
\label{lemma-existence-algebra}
Let $R \to S$ be a finite type ring map.
Let $M$ be a finite $S$-module.
Let $\mathfrak q$ be a prime ideal of $S$.
There exists an elementary \'etale localization
$R' \to S', \mathfrak q', \mathfrak p'$ of
the ring map $R \to S$ at $\mathfrak q$ such that
there exists a complete d\'evissage of
$(M \otimes_S S')/S'/R'$ at $\mathfrak q'$.
\end{lemma}

\begin{proof}
This is a reformulation of
Proposition \ref{proposition-existence-complete-at-x}
via
Remark \ref{remark-same-notion}
\end{proof}




\section{Localization and universally injective maps}
\label{section-localize-universally-injective}


\begin{lemma}
\label{lemma-homothety-spectrum}
Let $R \to S$ be a ring map.
Let $N$ be a $S$-module.
Assume
\begin{enumerate}
\item $R$ is a local ring with maximal ideal $\mathfrak m$,
\item $\overline{S} = S/\mathfrak m S$ is Noetherian, and
\item $\overline{N} = N/\mathfrak m_R N$ is a finite $\overline{S}$-module.
\end{enumerate}
Let $\Sigma \subset S$ be the multiplicative subset of elements which are not
a zerodivisor on $\overline{N}$. Then $\Sigma^{-1}S$ is a semi-local ring
whose spectrum consists of primes $\mathfrak q \subset S$ contained in an
element of $\text{Ass}_S(\overline{N})$. Moreover, any maximal
ideal of $\Sigma^{-1}S$ corresponds to an associated prime of
$\overline{N}$ over $\overline{S}$.
\end{lemma}

\begin{proof}
Note that
$\text{Ass}_S(\overline{N}) = \text{Ass}_{\overline{S}}(\overline{N})$, see
Algebra, Lemma \ref{algebra-lemma-ass-quotient-ring}.
This is a finite set by
Algebra, Lemma \ref{algebra-lemma-finite-ass}.
Say $\{\mathfrak q_1, \ldots, \mathfrak q_r\} = \text{Ass}_S(\overline{N})$.
We have $\Sigma = S \setminus (\bigcup \mathfrak q_i)$ by
Algebra, Lemma \ref{algebra-lemma-ass-zero-divisors}.
By the description of $\Spec(\Sigma^{-1}S)$ in
Algebra, Lemma \ref{algebra-lemma-spec-localization}
and by
Algebra, Lemma \ref{algebra-lemma-silly}
we see that the primes of $\Sigma^{-1}S$ correspond to the primes of
$S$ contained in one of the $\mathfrak q_i$.
Hence the maximal ideals of $\Sigma^{-1}S$ correspond one-to-one with the
maximal (w.r.t.\ inclusion) elements of the set
$\{\mathfrak q_1, \ldots, \mathfrak q_r\}$. This proves the lemma.
\end{proof}

\begin{lemma}
\label{lemma-homothety-universally-injective}
Assumption and notation as in
Lemma \ref{lemma-homothety-spectrum}.
Assume moreover that
\begin{enumerate}
\item $S$ is local and $R \to S$ is a local homomorphism,
\item $S$ is essentially of finite presentation over $R$,
\item $N$ is finitely presented over $S$, and
\item $N$ is flat over $R$.
\end{enumerate}
Then each $s \in \Sigma$ defines a
universally injective $R$-module map $s : N \to N$, and the
map $N \to \Sigma^{-1}N$ is $R$-universally injective.
\end{lemma}

\begin{proof}
By
Algebra, Lemma \ref{algebra-lemma-mod-injective-general}
the sequence $0 \to N \to N \to N/sN \to 0$ is exact and
$N/sN$ is flat over $R$. This implies that $s : N \to N$
is universally injective, see
Algebra, Lemma \ref{algebra-lemma-flat-tor-zero}.
The map $N \to \Sigma^{-1}N$ is universally injective as the directed
colimit of the maps $s : N \to N$.
\end{proof}

\begin{lemma}
\label{lemma-base-change-universally-flat-local}
Let $R \to S$ be a ring map.
Let $N$ be an $S$-module.
Let $S \to S'$ be a ring map.
Assume
\begin{enumerate}
\item $R \to S$ is a local homomorphism of local rings
\item $S$ is essentially of finite presentation over $R$,
\item $N$ is of finite presentation over $S$,
\item $N$ is flat over $R$,
\item $S \to S'$ is flat, and
\item the image of $\Spec(S') \to \Spec(S)$ contains
all primes $\mathfrak q$ of $S$ lying over $\mathfrak m_R$
such that $\mathfrak q$ is an associated prime of $N/\mathfrak m_R N$.
\end{enumerate}
Then $N \to N \otimes_S S'$ is $R$-universally injective.
\end{lemma}

\begin{proof}
Set $N' = N \otimes_R S'$. Consider the commutative diagram
$$
\xymatrix{
N \ar[d] \ar[r] & N' \ar[d] \\
\Sigma^{-1}N \ar[r] & \Sigma^{-1}N'
}
$$
where $\Sigma \subset S$ is the set of elements which are not a
zerodivisor on $N/\mathfrak m_R N$. If we can show that the map
$N \to \Sigma^{-1}N'$ is universally injective, then $N \to N'$
is too (see
Algebra, Lemma \ref{algebra-lemma-universally-injective-permanence}).

\medskip\noindent
By
Lemma \ref{lemma-homothety-spectrum}
the ring $\Sigma^{-1}S$ is a semi-local ring whose maximal ideals
correspond to associated primes of $N/\mathfrak m_R N$.
Hence the image of
$\Spec(\Sigma^{-1}S') \to \Spec(\Sigma^{-1}S)$
contains all these maximal ideals by assumption. By
Algebra, Lemma \ref{algebra-lemma-ff-rings}
the ring map $\Sigma^{-1}S \to \Sigma^{-1}S'$ is faithfully flat.
Hence $\Sigma^{-1}N \to \Sigma^{-1}N'$, which is the map
$$
N \otimes_S \Sigma^{-1}S \longrightarrow N \otimes_S \Sigma^{-1}S'
$$
is universally injective, see
Algebra, Lemmas \ref{algebra-lemma-faithfully-flat-universally-injective} and
\ref{algebra-lemma-universally-injective-tensor}.
Finally, we apply
Lemma \ref{lemma-homothety-universally-injective}
to see that $N \to \Sigma^{-1}N$ is universally injective.
As the composition of universally injective module maps is universally
injective (see
Algebra, Lemma \ref{algebra-lemma-composition-universally-injective})
we conclude that $N \to \Sigma^{-1}N'$ is universally injective and we win.
\end{proof}

\begin{lemma}
\label{lemma-base-change-universally-flat}
Let $R \to S$ be a ring map.
Let $N$ be an $S$-module.
Let $S \to S'$ be a ring map.
Assume
\begin{enumerate}
\item $R \to S$ is of finite presentation and $N$ is of finite presentation
over $S$,
\item $N$ is flat over $R$,
\item $S \to S'$ is flat, and
\item the image of $\Spec(S') \to \Spec(S)$ contains
all primes $\mathfrak q$ such that $\mathfrak q$ is an associated prime
of $N \otimes_R \kappa(\mathfrak p)$ where $\mathfrak p$ is the inverse
image of $\mathfrak q$ in $R$.
\end{enumerate}
Then $N \to N \otimes_S S'$ is $R$-universally injective.
\end{lemma}

\begin{proof}
By
Algebra, Lemma \ref{algebra-lemma-universally-injective-check-stalks}
it suffices to show that $N_{\mathfrak q} \to (N \otimes_R S')_{\mathfrak q}$
is a $R_{\mathfrak p}$-universally injective for any prime $\mathfrak q$
of $S$ lying over $\mathfrak p$ in $R$. Thus we may apply
Lemma \ref{lemma-base-change-universally-flat-local}
to the ring maps
$R_{\mathfrak p} \to S_{\mathfrak q} \to S'_{\mathfrak q}$
and the module $N_{\mathfrak q}$.
\end{proof}

\noindent
The reader may want to compare the following lemma to
Algebra, Lemmas \ref{algebra-lemma-mod-injective} and
\ref{algebra-lemma-mod-injective-general} and the results of
Section \ref{section-variants-mod-injective}.
In each case the conclusion is that the map $u : M \to N$ is
universally injective with flat cokernel.

\begin{lemma}
\label{lemma-universally-injective-local}
Let $(R, \mathfrak m)$ be a local ring. Let $u : M \to N$ be an $R$-module map.
If $M$ is a projective $R$-module, $N$ is a flat $R$-module, and
$\overline{u} : M/\mathfrak mM \to N/\mathfrak mN$ is injective
then $u$ is universally injective.
\end{lemma}

\begin{proof}
By
Algebra, Theorem \ref{algebra-theorem-projective-free-over-local-ring}
the module $M$ is free. If we show the result holds for every finitely
generated direct summand of $M$, then the lemma follows. Hence we may
assume that $M$ is finite free. Write $N = \colim_i N_i$ as
a directed colimit of finite free modules, see
Algebra, Theorem \ref{algebra-theorem-lazard}.
Note that $u : M \to N$ factors through $N_i$ for some $i$ (as $M$ is finite
free). Denote $u_i : M \to N_i$ the corresponding $R$-module map.
As $\overline{u}$ is injective we see that
$\overline{u_i} : M/\mathfrak mM \to N_i/\mathfrak mN_i$ is
injective and remains injective on composing with the maps
$N_i/\mathfrak mN_i \to N_{i'}/\mathfrak mN_{i'}$ for all $i' \geq i$.
As $M$ and $N_{i'}$ are finite free over the local ring $R$ this implies
that $M \to N_{i'}$ is a split injection for all $i' \geq i$. Hence
for any $R$-module $Q$ we see that $M \otimes_R Q \to N_{i'} \otimes_R Q$
is injective for all $i' \geq i$. As $- \otimes_R Q$ commutes with
colimits we conclude that $M \otimes_R Q \to N_{i'} \otimes_R Q$
is injective as desired.
\end{proof}

\begin{lemma}
\label{lemma-invert-universally-injective}
Assumption and notation as in
Lemma \ref{lemma-homothety-spectrum}.
Assume moreover that $N$ is projective as an $R$-module.
Then each $s \in \Sigma$ defines a
universally injective $R$-module map $s : N \to N$, and the
map $N \to \Sigma^{-1}N$ is $R$-universally injective.
\end{lemma}

\begin{proof}
Pick $s \in \Sigma$. By
Lemma \ref{lemma-universally-injective-local}
the map $s : N \to N$ is universally injective.
The map $N \to \Sigma^{-1}N$ is universally injective as the directed
colimit of the maps $s : N \to N$.
\end{proof}






\section{Completion and Mittag-Leffler modules}
\label{section-completion-ML}


\begin{lemma}
\label{lemma-completed-direct-sum-ML}
Let $R$ be a ring. Let $I \subset R$ be an ideal. Let $A$ be a set.
Assume $R$ is Noetherian and complete with respect to $I$. The completion
$(\bigoplus\nolimits_{\alpha \in A} R)^\wedge$
is flat and Mittag-Leffler.
\end{lemma}

\begin{proof}
By
More on Algebra, Lemma
\ref{more-algebra-lemma-ui-completion-direct-sum-into-product}
the map $(\bigoplus\nolimits_{\alpha \in A} R)^\wedge
\to \prod_{\alpha \in A} R$ is universally injective.
Thus, by
Algebra, Lemmas \ref{algebra-lemma-ui-flat-domain} and
\ref{algebra-lemma-pure-submodule-ML}
it suffices to show that $\prod_{\alpha \in A} R$ is flat and Mittag-Leffler.
By
Algebra, Proposition \ref{algebra-proposition-characterize-coherent}
(and
Algebra, Lemma \ref{algebra-lemma-Noetherian-coherent})
we see that $\prod_{\alpha \in A} R$ is flat.
Thus we conclude because a product of copies of $R$ is Mittag-Leffler, see
Algebra, Lemma \ref{algebra-lemma-product-over-Noetherian-ring}.
\end{proof}

\begin{lemma}
\label{lemma-lift-ML}
Let $R$ be a ring. Let $I \subset R$ be an ideal.
Let $M$ be an $R$-module.
Assume
\begin{enumerate}
\item $R$ is Noetherian and $I$-adically complete,
\item $M$ is flat over $R$, and
\item $M/IM$ is a projective $R/I$-module.
\end{enumerate}
Then the $I$-adic completion $M^\wedge$ is a flat Mittag-Leffler
$R$-module.
\end{lemma}

\begin{proof}
Choose a surjection $F \to M$ where $F$ is a free $R$-module. By
Algebra, Lemma \ref{algebra-lemma-split-completed-sequence}
the module $M^\wedge$ is a direct summand of the module $F^\wedge$.
Hence it suffices to prove the lemma for $F$.
In this case the lemma follows from
Lemma \ref{lemma-completed-direct-sum-ML}.
\end{proof}

\noindent
In
Lemmas \ref{lemma-universally-injective-to-completion} and
\ref{lemma-universally-injective-to-completion-flat}
the assumption that $S$ be Noetherian holds if $R \to S$ is of finite type, see
Algebra, Lemma \ref{algebra-lemma-Noetherian-permanence}.

\begin{lemma}
\label{lemma-universally-injective-to-completion}
Let $R$ be a ring.
Let $I \subset R$ be an ideal.
Let $R \to S$ be a ring map, and $N$ an $S$-module.
Assume
\begin{enumerate}
\item $R$ is a Noetherian ring,
\item $S$ is a Noetherian ring,
\item $N$ is a finite $S$-module, and
\item for any finite $R$-module $Q$, any
$\mathfrak q \in \text{Ass}_S(Q \otimes_R N)$
satisfies $IS + \mathfrak q \not = S$.
\end{enumerate}
Then the map $N \to N^\wedge$ of $N$ into the $I$-adic completion of $N$
is universally injective as a map of $R$-modules.
\end{lemma}

\begin{proof}
We have to show that for any finite $R$-module $Q$ the map
$Q \otimes_R N \to Q \otimes_R N^\wedge$ is injective, see
Algebra, Theorem \ref{algebra-theorem-universally-exact-criteria}.
As there is a canonical map $Q \otimes_R N^\wedge \to (Q \otimes_R N)^\wedge$
it suffices to prove that the canonical map
$Q \otimes_R N \to (Q \otimes_R N)^\wedge$ is injective.
Hence we may replace $N$ by $Q \otimes_R N$ and it suffices to prove the
injectivity for the map $N \to N^\wedge$.

\medskip\noindent
Let $K = \Ker(N \to N^\wedge)$. It suffices to show that
$K_{\mathfrak q} = 0$ for $\mathfrak q \in \text{Ass}(N)$ as $N$ is a
submodule of $\prod_{\mathfrak q \in \text{Ass}(N)} N_{\mathfrak q}$, see
Algebra, Lemma \ref{algebra-lemma-zero-at-ass-zero}.
Pick $\mathfrak q \in \text{Ass}(N)$. By the last assumption we see that
there exists a prime $\mathfrak q' \supset IS + \mathfrak q$.
Since $K_{\mathfrak q}$ is a localization of $K_{\mathfrak q'}$
it suffices to prove the vanishing of $K_{\mathfrak q'}$.
Note that $K = \bigcap I^nN$, hence
$K_{\mathfrak q'} \subset \bigcap I^nN_{\mathfrak q'}$.
Hence $K_{\mathfrak q'} = 0$ by
Algebra, Lemma \ref{algebra-lemma-intersect-powers-ideal-module-zero}.
\end{proof}

\begin{lemma}
\label{lemma-universally-injective-to-completion-flat}
Let $R$ be a ring.
Let $I \subset R$ be an ideal.
Let $R \to S$ be a ring map, and $N$ an $S$-module.
Assume
\begin{enumerate}
\item $R$ is a Noetherian ring,
\item $S$ is a Noetherian ring,
\item $N$ is a finite $S$-module,
\item $N$ is flat over $R$, and
\item for any prime $\mathfrak q \subset S$ which is an associated prime of
$N \otimes_R \kappa(\mathfrak p)$ where $\mathfrak p = R \cap \mathfrak q$
we have $IS + \mathfrak q \not = S$.
\end{enumerate}
Then the map $N \to N^\wedge$ of $N$ into the $I$-adic completion of $N$
is universally injective as a map of $R$-modules.
\end{lemma}

\begin{proof}
This follows from
Lemma \ref{lemma-universally-injective-to-completion}
because
Algebra, Lemma
\ref{algebra-lemma-bourbaki-fibres} and
Remark \ref{algebra-remark-bourbaki}
guarantee that the set of associated primes of tensor products
$N \otimes_R Q$ are contained in the set of associated primes of
the modules $N \otimes_R \kappa(\mathfrak p)$.
\end{proof}




\section{Projective modules}
\label{section-projective}

\noindent
The following lemma can be used to prove projectivity by
Noetherian induction on the base, see
Lemma \ref{lemma-fibres-irreducible-flat-projective}.

\begin{lemma}
\label{lemma-flat-pure-over-complete-projective}
Let $R$ be a ring.
Let $I \subset R$ be an ideal.
Let $R \to S$ be a ring map, and $N$ an $S$-module.
Assume
\begin{enumerate}
\item $R$ is Noetherian and $I$-adically complete,
\item $R \to S$ is of finite type,
\item $N$ is a finite $S$-module,
\item $N$ is flat over $R$,
\item $N/IN$ is projective as a $R/I$-module, and
\item for any prime $\mathfrak q \subset S$ which is an associated prime of
$N \otimes_R \kappa(\mathfrak p)$ where $\mathfrak p = R \cap \mathfrak q$
we have $IS + \mathfrak q \not = S$.
\end{enumerate}
Then $N$ is projective as an $R$-module.
\end{lemma}

\begin{proof}
By
Lemma \ref{lemma-universally-injective-to-completion-flat}
the map $N \to N^\wedge$ is universally injective.
By
Lemma \ref{lemma-lift-ML}
the module $N^\wedge$ is Mittag-Leffler.
By
Algebra, Lemma \ref{algebra-lemma-pure-submodule-ML}
we conclude that $N$ is Mittag-Leffler.
Hence $N$ is countably generated, flat and Mittag-Leffler as an $R$-module,
whence projective by
Algebra, Lemma \ref{algebra-lemma-countgen-projective}.
\end{proof}

\begin{lemma}
\label{lemma-fibres-irreducible-flat-projective}
Let $R$ be a ring.
Let $R \to S$ be a ring map.
Assume
\begin{enumerate}
\item $R$ is Noetherian,
\item $R \to S$ is of finite type and flat, and
\item every fibre ring $S \otimes_R \kappa(\mathfrak p)$ is
geometrically integral over $\kappa(\mathfrak p)$.
\end{enumerate}
Then $S$ is projective as an $R$-module.
\end{lemma}

\begin{proof}
Consider the set
$$
\{I \subset R \mid S/IS\text{ not projective as }R/I\text{-module}\}
$$
We have to show this set is empty. To get a contradiction assume it is
nonempty. Then it contains a maximal element $I$.
Let $J = \sqrt{I}$ be its radical. If $I \not = J$, then
$S/JS$ is projective as a $R/J$-module, and $S/IS$ is flat over $R/I$
and $J/I$ is a nilpotent ideal in $R/I$. Applying
Algebra, Lemma \ref{algebra-lemma-lift-projective}
we see that $S/IS$ is a projective $R/I$-module, which is a contradiction.
Hence we may assume that $I$ is a radical ideal. In other words we
are reduced to proving the lemma in case $R$ is a reduced ring and
$S/IS$ is a projective $R/I$-module for every nonzero ideal $I$
of $R$.

\medskip\noindent
Assume $R$ is a reduced ring and $S/IS$ is a projective $R/I$-module
for every nonzero ideal $I$ of $R$. By generic flatness,
Algebra, Lemma \ref{algebra-lemma-generic-flatness-Noetherian}
(applied to a localization $R_g$ which is a domain) or the more general
Algebra, Lemma \ref{algebra-lemma-generic-flatness-reduced}
there exists a nonzero $f \in R$ such that $S_f$ is free as an
$R_f$-module. Denote $R^\wedge = \lim R/(f^n)$ the $(f)$-adic completion
of $R$. Note that the ring map
$$
R \longrightarrow R_f \times R^\wedge
$$
is a faithfully flat ring map, see
Algebra, Lemma \ref{algebra-lemma-completion-flat}.
Hence by faithfully flat descent of projectivity, see
Algebra, Theorem \ref{algebra-theorem-ffdescent-projectivity}
it suffices to prove that $S \otimes_R R^\wedge$ is a projective
$R^\wedge$-module. To see this we will use the criterion of
Lemma \ref{lemma-flat-pure-over-complete-projective}.
First of all, note that $S/fS = (S \otimes_R R^\wedge)/f(S \otimes_R R^\wedge)$
is a projective $R/(f)$-module and that $S \otimes_R R^\wedge$ is flat
and of finite type over $R^\wedge$ as a base change of such.
Next, suppose that $\mathfrak p^\wedge$ is a prime ideal
of $R^\wedge$. Let $\mathfrak p \subset R$ be the corresponding prime
of $R$. As $R \to S$ has geometrically integral fibre rings, the
same is true for the fibre rings of any base change. Hence
$\mathfrak q^\wedge = \mathfrak p^\wedge(S \otimes_R R^\wedge)$,
is a prime ideals lying over $\mathfrak p^\wedge$
and it is the unique associated prime of
$S \otimes_R \kappa(\mathfrak p^\wedge)$. Thus we win if
$f(S \otimes_R R^\wedge) + \mathfrak q^\wedge \not = S \otimes_R R^\wedge$.
This is true because $\mathfrak p^\wedge + fR^\wedge \not = R^\wedge$ as
$f$ lies in the Jacobson radical of the $f$-adically complete ring $R^\wedge$
and because $R^\wedge \to S \otimes_R R^\wedge$ is surjective on spectra
as its fibres are nonempty (irreducible spaces are nonempty).
\end{proof}

\begin{lemma}
\label{lemma-fibres-irreducible-flat-projective-nonnoetherian}
Let $R$ be a ring. Let $R \to S$ be a ring map.
Assume
\begin{enumerate}
\item $R \to S$ is of finite presentation and flat, and
\item every fibre ring $S \otimes_R \kappa(\mathfrak p)$ is
geometrically integral over $\kappa(\mathfrak p)$.
\end{enumerate}
Then $S$ is projective as an $R$-module.
\end{lemma}

\begin{proof}
We can find a cocartesian diagram of rings
$$
\xymatrix{
S_0 \ar[r] & S \\
R_0 \ar[u] \ar[r] & R \ar[u]
}
$$
such that $R_0$ is of finite type over $\mathbf{Z}$, the map
$R_0 \to S_0$ is of finite type and flat with geometrically integral
fibres, see
More on Morphisms,
Lemmas \ref{more-morphisms-lemma-Noetherian-approximation-flat},
\ref{more-morphisms-lemma-Noetherian-approximation-geometrically-reduced},
\ref{more-morphisms-lemma-Noetherian-approximation-geometrically-irreducible},
and \ref{more-morphisms-lemma-Noetherian-approximation-combine}.
By
Lemma \ref{lemma-fibres-irreducible-flat-projective}
we see that $S_0$ is a projective $R_0$-module. Hence $S = S_0 \otimes_{R_0} R$
is a projective $R$-module, see
Algebra, Lemma \ref{algebra-lemma-ascend-properties-modules}.
\end{proof}

\begin{remark}
\label{remark-how-in-RG}
Lemma \ref{lemma-fibres-irreducible-flat-projective-nonnoetherian}
is a key step in the development of results in this chapter. The analogue
of this lemma in \cite{GruRay} is \cite[I Proposition 3.3.1]{GruRay}:
If $R \to S$ is smooth with geometrically integral fibres, then $S$
is projective as an $R$-module. This is a special case of
Lemma \ref{lemma-fibres-irreducible-flat-projective-nonnoetherian},
but as we will later improve on this lemma anyway, we do not gain much
from having a stronger result at this point.
We briefly sketch the proof of this as it is given in \cite{GruRay}.
\begin{enumerate}
\item First reduce to the case where $R$ is Noetherian as above.
\item Since projectivity descends through faithfully flat ring maps, see
Algebra, Theorem \ref{algebra-theorem-ffdescent-projectivity}
we may work locally in the fppf topology on $R$, hence we may assume
that $R \to S$ has a section $\sigma : S \to R$. (Just by the usual trick of
base changing to $S$.) Set $I = \Ker(S \to R)$.
\item Localizing a bit more on $R$ we may assume that $I/I^2$ is a free
$R$-module and that the completion $S^\wedge$ of $S$ with respect to $I$
is isomorphic to $R[[t_1, \ldots, t_n]]$, see
Morphisms, Lemma \ref{morphisms-lemma-section-smooth-morphism}.
Here we are using that $R \to S$ is smooth.
\item To prove that $S$ is projective as an $R$-module, it suffices to
prove that $S$ is flat, countably generated and Mittag-Leffler as an
$R$-module, see
Algebra, Lemma \ref{algebra-lemma-countgen-projective}.
The first two properties are evident. Thus it suffices to prove that $S$
is Mittag-Leffler as an $R$-module. By
Algebra, Lemma \ref{algebra-lemma-power-series-ML}
the module $R[[t_1, \ldots, t_n]]$ is Mittag-Leffler over $R$. Hence
Algebra, Lemma \ref{algebra-lemma-pure-submodule-ML}
shows that it suffices to show that the
$S \to S^\wedge$ is universally injective as a map of $R$-modules.
\item Apply
Lemma \ref{lemma-base-change-universally-flat}
to see that $S \to S^\wedge$ is $R$-universally injective.
Namely, as $R \to S$ has geometrically integral fibres, any associated
point of any fibre ring is just the generic point of the fibre ring which
is in the image of $\Spec(S^\wedge) \to \Spec(S)$.
\end{enumerate}
There is an analogy between the proof as sketched just now, and the
development of the arguments leading to the proof of
Lemma \ref{lemma-fibres-irreducible-flat-projective-nonnoetherian}.
In both a completion plays an essential role, and both times the
assumption of having geometrically integral fibres assures one that the
map from $S$ to the completion of $S$ is $R$-universally injective.
\end{remark}













\section{Flat finite type modules, Part I}
\label{section-finite-type-flat-I}

\noindent
In some cases given a ring map $R \to S$ of finite presentation and
a finite $S$-module $N$ the flatness of $N$ over $R$ implies that $N$
is of finite presentation. In this section we prove this is true
``pointwise''. We remark that the first proof of
Proposition \ref{proposition-finite-type-flat-at-point}
uses the geometric results of
Section \ref{section-local-structure-module}
but not the existence of a complete d\'evissage.

\begin{lemma}
\label{lemma-induction-step}
Let $(R, \mathfrak m)$ be a local ring. Let $R \to S$ be a finitely presented
flat ring map with geometrically integral fibres. Write
$\mathfrak p = \mathfrak mS$. Let $\mathfrak q \subset S$ be a prime ideal
lying over $\mathfrak m$. Let $N$ be a finite $S$-module.
There exist $r \geq 0$ and an $S$-module map
$$
\alpha : S^{\oplus r} \longrightarrow N
$$
such that
$\alpha : \kappa(\mathfrak p)^{\oplus r} \to N \otimes_S \kappa(\mathfrak p)$
is an isomorphism. For any such $\alpha$ the following are equivalent:
\begin{enumerate}
\item $N_{\mathfrak q}$ is $R$-flat,
\item $\alpha$ is $R$-universally injective and
$\Coker(\alpha)_{\mathfrak q}$ is $R$-flat,
\item $\alpha$ is injective and
$\Coker(\alpha)_{\mathfrak q}$ is $R$-flat,
\item $\alpha_{\mathfrak p}$ is an isomorphism and
$\Coker(\alpha)_{\mathfrak q}$ is $R$-flat, and
\item $\alpha_{\mathfrak q}$ is injective and
$\Coker(\alpha)_{\mathfrak q}$ is $R$-flat.
\end{enumerate}
\end{lemma}

\begin{proof}
To obtain $\alpha$ set
$r = \dim_{\kappa(\mathfrak p)} N \otimes_S \kappa(\mathfrak p)$ and pick
$x_1, \ldots, x_r \in N$ which form a basis of
$N \otimes_S \kappa(\mathfrak p)$. Define
$\alpha(s_1, \ldots, s_r) = \sum s_i x_i$. This proves the existence.

\medskip\noindent
Fix an $\alpha$. The most interesting implication is
(1) $\Rightarrow$ (2) which we prove first. Assume (1).
Because $S/\mathfrak mS$ is a domain with fraction field $\kappa(\mathfrak p)$
we see that
$(S/\mathfrak mS)^{\oplus r} \to
N_{\mathfrak p}/\mathfrak mN_{\mathfrak p} = N \otimes_S \kappa(\mathfrak p)$
is injective. Hence by
Lemmas \ref{lemma-universally-injective-local} and
\ref{lemma-fibres-irreducible-flat-projective-nonnoetherian}.
the map $S^{\oplus r} \to N_{\mathfrak p}$ is $R$-universally injective.
It follows that $S^{\oplus r} \to N$ is $R$-universally injective, see
Algebra, Lemma \ref{algebra-lemma-universally-injective-permanence}.
Then also the localization $\alpha_{\mathfrak q}$ is $R$-universally
injective, see
Algebra, Lemma \ref{algebra-lemma-universally-injective-localize}.
We conclude that $\Coker(\alpha)_{\mathfrak q}$ is $R$-flat by
Algebra, Lemma \ref{algebra-lemma-ui-flat-domain}.

\medskip\noindent
The implication (2) $\Rightarrow$ (3) is immediate. If (3) holds, then
$\alpha_{\mathfrak p}$ is injective as a localization of an injective
module map. By Nakayama's lemma
(Algebra, Lemma \ref{algebra-lemma-NAK})
$\alpha_{\mathfrak p}$ is surjective too. Hence (3) $\Rightarrow$ (4).
If (4) holds, then $\alpha_{\mathfrak p}$ is an isomorphism, so
$\alpha$ is injective as $S_{\mathfrak q} \to S_{\mathfrak p}$ is injective.
Namely, elements of $S \setminus \mathfrak p$ are nonzerodivisors on $S$
by a combination of
Lemmas \ref{lemma-invert-universally-injective} and
\ref{lemma-fibres-irreducible-flat-projective-nonnoetherian}.
Hence (4) $\Rightarrow$ (5). Finally, if (5) holds, then
$N_{\mathfrak q}$ is $R$-flat as an extension of flat modules, see
Algebra, Lemma \ref{algebra-lemma-flat-ses}.
Hence (5) $\Rightarrow$ (1) and the proof is finished.
\end{proof}

\begin{lemma}
\label{lemma-complete-devissage-flat-finite-type-module}
Let $(R, \mathfrak m)$ be a local ring.
Let $R \to S$ be a ring map of finite presentation.
Let $N$ be a finite $S$-module.
Let $\mathfrak q$ be a prime of $S$ lying over $\mathfrak m$.
Assume that $N_{\mathfrak q}$ is flat over $R$, and
assume there exists a complete d\'evissage of $N/S/R$ at $\mathfrak q$.
Then $N$ is a finitely presented $S$-module, free as an $R$-module,
and there exists an isomorphism
$$
N \cong B_1^{\oplus r_1} \oplus \ldots \oplus B_n^{\oplus r_n}
$$
as $R$-modules where each $B_i$ is a smooth $R$-algebra with geometrically
irreducible fibres.
\end{lemma}

\begin{proof}
Let $(A_i, B_i, M_i, \alpha_i, \mathfrak q_i)_{i = 1, \ldots, n}$
be the given complete d\'evissage. We prove the lemma by induction on $n$.
Note that $N$ is finitely presented as an $S$-module if and only if
$M_1$ is finitely presented as an $B_1$-module, see
Remark \ref{remark-finite-presentation}.
Note that $N_{\mathfrak q} \cong (M_1)_{\mathfrak q_1}$ as $R$-modules
because (a) $N_{\mathfrak q} \cong (M_1)_{\mathfrak q'_1}$ where
$\mathfrak q'_1$ is the unique prime in $A_1$ lying over $\mathfrak q_1$
and (b) $(A_1)_{\mathfrak q'_1} = (A_1)_{\mathfrak q_1}$ by
Algebra, Lemma \ref{algebra-lemma-unique-prime-over-localize-below},
so (c) $(M_1)_{\mathfrak q'_1} \cong (M_1)_{\mathfrak q_1}$.
Hence $(M_1)_{\mathfrak q_1}$ is a flat $R$-module. Thus we may replace
$(S, N)$ by $(B_1, M_1)$ in order to prove the lemma. By
Lemma \ref{lemma-induction-step}
the map $\alpha_1 : B_1^{\oplus r_1} \to M_1$ is $R$-universally injective
and $\Coker(\alpha_1)_{\mathfrak q}$ is $R$-flat.
Note that $(A_i, B_i, M_i, \alpha_i, \mathfrak q_i)_{i = 2, \ldots, n}$
is a complete d\'evissage of $\Coker(\alpha_1)/B_1/R$ at
$\mathfrak q_1$. Hence the induction hypothesis
implies that $\Coker(\alpha_1)$ is finitely presented as a
$B_1$-module, free as an $R$-module, and has a decomposition as in the lemma.
This implies that $M_1$ is finitely presented as a $B_1$-module, see
Algebra, Lemma \ref{algebra-lemma-extension}.
It further implies that
$M_1 \cong B_1^{\oplus r_1} \oplus \Coker(\alpha_1)$
as $R$-modules, hence a decomposition as in the lemma.
Finally, $B_1$ is projective as an $R$-module by
Lemma \ref{lemma-fibres-irreducible-flat-projective-nonnoetherian}
hence free as an $R$-module by
Algebra, Theorem \ref{algebra-theorem-projective-free-over-local-ring}.
This finishes the proof.
\end{proof}

\begin{proposition}
\label{proposition-finite-type-flat-at-point}
Let $f : X \to S$ be a morphism of schemes.
Let $\mathcal{F}$ be a quasi-coherent sheaf on $X$.
Let $x \in X$ with image $s \in S$.
Assume that
\begin{enumerate}
\item $f$ is locally of finite presentation,
\item $\mathcal{F}$ is of finite type, and
\item $\mathcal{F}$ is flat at $x$ over $S$.
\end{enumerate}
Then there exists an elementary \'etale neighbourhood $(S', s') \to (S, s)$
and an open subscheme
$$
V \subset X \times_S \Spec(\mathcal{O}_{S', s'})
$$
which contains the unique point of
$X \times_S \Spec(\mathcal{O}_{S', s'})$ mapping to $x$
such that the pullback of $\mathcal{F}$ to $V$ is an $\mathcal{O}_V$-module
of finite presentation and flat over $\mathcal{O}_{S', s'}$.
\end{proposition}

\begin{proof}[First proof]
This proof is longer but does not use the existence of a complete d\'evissage.
The problem is local around $x$ and $s$, hence we may assume that $X$
and $S$ are affine. During the proof we will finitely many times replace
$S$ by an elementary \'etale neighbourhood of $(S, s)$. The goal is then to find
(after such a replacement) an open
$V \subset X \times_S \Spec(\mathcal{O}_{S, s})$ containing $x$
such that $\mathcal{F}|_V$ is flat over $S$ and finitely presented.
Of course we may also replace $S$ by $\Spec(\mathcal{O}_{S, s})$
at any point of the proof, i.e., we may assume $S$ is a local scheme.
We will prove the proposition by induction on the integer
$n = \dim_x(\text{Supp}(\mathcal{F}_s))$.

\medskip\noindent
We can choose
\begin{enumerate}
\item elementary \'etale neighbourhoods $g : (X', x') \to (X, x)$,
$e : (S', s') \to (S, s)$,
\item a commutative diagram
$$
\xymatrix{
X \ar[dd]_f & X' \ar[dd] \ar[l]^g & Z' \ar[l]^i \ar[d]^\pi \\
& & Y' \ar[d]^h \\
S & S' \ar[l]_e & S' \ar@{=}[l]
}
$$
\item a point $z' \in Z'$ with $i(z') = x'$, $y' = \pi(z')$, $h(y') = s'$,
\item a finite type quasi-coherent $\mathcal{O}_{Z'}$-module $\mathcal{G}$,
\end{enumerate}
as in
Lemma \ref{lemma-elementary-devissage}.
We are going to replace $S$ by $\Spec(\mathcal{O}_{S', s'})$, see
remarks in first paragraph of the proof. Consider the diagram
$$
\xymatrix{
X_{\mathcal{O}_{S', s'}} \ar[ddr]_f &
X'_{\mathcal{O}_{S', s'}} \ar[dd] \ar[l]^g &
Z'_{\mathcal{O}_{S', s'}} \ar[l]^i \ar[d]^\pi \\
& & Y'_{\mathcal{O}_{S', s'}} \ar[dl]^h \\
& \Spec(\mathcal{O}_{S', s'})
}
$$
Here we have base changed the schemes $X', Z', Y'$ over $S'$ via
$\Spec(\mathcal{O}_{S', s'}) \to S'$ and the scheme $X$ over $S$ via
$\Spec(\mathcal{O}_{S', s'}) \to S$. It is still the case that
$g$ is \'etale, see
Lemma \ref{lemma-etale-at-point}.
After replacing $X$ by $X_{\mathcal{O}_{S', s'}}$,
$X'$ by $X'_{\mathcal{O}_{S', s'}}$,
$Z'$ by $Z'_{\mathcal{O}_{S', s'}}$, and
$Y'$ by $Y'_{\mathcal{O}_{S', s'}}$
we may assume we have a diagram as
Lemma \ref{lemma-elementary-devissage}
where in addition $S = S'$ is a local scheme with closed point $s$. By
Lemmas \ref{lemma-devissage-finite-presentation} and
\ref{lemma-devissage-flat}
the result for $Y' \to S$, the sheaf $\pi_*\mathcal{G}$, and the
point $y'$ implies the result for $X \to S$, $\mathcal{F}$ and $x$.
Hence we may assume that $S$ is local and $X \to S$ is a smooth morphism
of affines with geometrically irreducible fibres of dimension $n$.

\medskip\noindent
The base case of the induction: $n = 0$.
As $X \to S$ is smooth with geometrically
irreducible fibres of dimension $0$ we see that $X \to S$ is an open
immersion, see
Descent, Lemma \ref{descent-lemma-universally-injective-etale-open-immersion}.
As $S$ is local and the closed point is in the image of $X \to S$
we conclude that $X = S$. Thus we see that $\mathcal{F}$ corresponds
to a finite flat $\mathcal{O}_{S, s}$ module. In this case the result
follows from
Algebra, Lemma \ref{algebra-lemma-finite-flat-local}
which tells us that $\mathcal{F}$ is in fact finite free.

\medskip\noindent
The induction step. Assume the result holds whenever the dimension
of the support in the closed fibre is $< n$. Write $S = \Spec(A)$,
$X = \Spec(B)$ and $\mathcal{F} = \widetilde{N}$ for some $B$-module
$N$. Note that $A$ is a local ring; denote its maximal ideal $\mathfrak m$.
Then $\mathfrak p = \mathfrak mB$ is the unique minimal prime lying over
$\mathfrak m$ as $X \to S$ has geometrically irreducible fibres. Finally,
let $\mathfrak q \subset B$ be the prime corresponding to $x$. By
Lemma \ref{lemma-induction-step}
we can choose a map
$$
\alpha : B^{\oplus r} \to N
$$
such that $\kappa(\mathfrak p)^{\oplus r} \to N \otimes_B \kappa(\mathfrak p)$
is an isomorphism. Moreover, as $N_{\mathfrak q}$ is $A$-flat the lemma
also shows that $\alpha$ is injective and that
$\Coker(\alpha)_{\mathfrak q}$ is $A$-flat.
Set $Q = \Coker(\alpha)$. Note that the support of $Q/\mathfrak mQ$
does not contain $\mathfrak p$. Hence it is certainly the case that
$\dim_{\mathfrak q}(\text{Supp}(Q/\mathfrak mQ)) < n$.
Combining everything we know about $Q$ we see
that the induction hypothesis applies to $Q$. It follows that there exists
an elementary \'etale morphism $(S', s) \to (S, s)$ such that the conclusion
holds for $Q \otimes_A A'$ over $B \otimes_A A'$ where
$A' = \mathcal{O}_{S', s'}$. After replacing $A$ by $A'$ we have an
exact sequence
$$
0 \to B^{\oplus r} \to N \to Q \to 0
$$
(here we use that $\alpha$ is injective as mentioned above)
of finite $B$-modules and we also get an element
$g \in B$, $g \not \in \mathfrak q$ such that
$Q_g$ is finitely presented over $B_g$ and flat over $A$. Since localization
is exact we see that
$$
0 \to B_g^{\oplus r} \to N_g \to Q_g \to 0
$$
is still exact. As $B_g$ and $Q_g$ are flat over $A$ we conclude that
$N_g$ is flat over $A$, see
Algebra, Lemma \ref{algebra-lemma-flat-ses},
and as $B_g$ and $Q_g$ are finitely presented over $B_g$ the same holds
for $N_g$, see
Algebra, Lemma \ref{algebra-lemma-extension}.
\end{proof}

\begin{proof}[Second proof]
We apply
Proposition \ref{proposition-existence-complete-at-x}
to find a commutative diagram
$$
\xymatrix{
(X, x) \ar[d] & (X', x') \ar[l]^g \ar[d] \\
(S, s) & (S', s') \ar[l]
}
$$
of pointed schemes such that the horizontal
arrows are elementary \'etale neighbourhoods
and such that $g^*\mathcal{F}/X'/S'$ has a complete
d\'evissage at $x$.
(In particular $S'$ and $X'$ are affine.) By
Morphisms, Lemma \ref{morphisms-lemma-flat-permanence}
we see that $g^*\mathcal{F}$ is flat at $x'$ over $S$ and by
Lemma \ref{lemma-etale-flat-up-down}
we see that it is flat at $x'$ over $S'$. Via
Remark \ref{remark-same-notion}
we deduce that
$$
\Gamma(X', g^*\mathcal{F})/
\Gamma(X', \mathcal{O}_{X'})/
\Gamma(S', \mathcal{O}_{S'})
$$
has a complete d\'evissage at the prime of $\Gamma(X', \mathcal{O}_{X'})$
corresponding to $x'$. We may base change this complete
d\'evissage to the local ring $\mathcal{O}_{S', s'}$
of $\Gamma(S', \mathcal{O}_{S'})$ at the prime corresponding to
$s'$. Thus
Lemma \ref{lemma-complete-devissage-flat-finite-type-module}
implies that
$$
\Gamma(X', \mathcal{F}')
\otimes_{\Gamma(S', \mathcal{O}_{S'})}
\mathcal{O}_{S', s'}
$$
is flat over $\mathcal{O}_{S', s'}$ and of finite presentation over
$\Gamma(X', \mathcal{O}_{X'})
\otimes_{\Gamma(S', \mathcal{O}_{S'})} \mathcal{O}_{S', s'}$.
In other words, the restriction of $\mathcal{F}$ to
$X' \times_{S'} \Spec(\mathcal{O}_{S', s'})$
is of finite presentation and flat over $\mathcal{O}_{S', s'}$.
Since the morphism
$X' \times_{S'} \Spec(\mathcal{O}_{S', s'})
\to X \times_S \Spec(\mathcal{O}_{S', s'})$
is \'etale
(Lemma \ref{lemma-etale-at-point})
its image $V \subset X \times_S \Spec(\mathcal{O}_{S', s'})$
is an open subscheme, and by \'etale descent the restriction
of $\mathcal{F}$ to $V$ is of finite presentation and flat over
$\mathcal{O}_{S', s'}$. (Results used:
Morphisms, Lemma \ref{morphisms-lemma-etale-open},
Descent, Lemma \ref{descent-lemma-finite-presentation-descends}, and
Morphisms, Lemma \ref{morphisms-lemma-flat-permanence}.)
\end{proof}

\begin{lemma}
\label{lemma-open-in-fibre-where-flat}
Let $f : X \to S$ be a morphism of schemes which is locally of finite type.
Let $\mathcal{F}$ be a quasi-coherent $\mathcal{O}_X$-module of finite type.
Let $s \in S$. Then the set
$$
\{x \in X_s \mid \mathcal{F} \text{ flat over }S\text{ at }x\}
$$
is open in the fibre $X_s$.
\end{lemma}

\begin{proof}
Suppose $x \in U$. Choose an elementary \'etale neighbourhood
$(S', s') \to (S, s)$ and open
$V \subset X \times_S \Spec(\mathcal{O}_{S', s'})$ as in
Proposition \ref{proposition-finite-type-flat-at-point}.
Note that $X_{s'} = X_s$ as $\kappa(s) = \kappa(s')$.
If $x' \in V \cap X_{s'}$, then the pullback of $\mathcal{F}$ to
$X \times_S S'$ is flat over $S'$ at $x'$. Hence $\mathcal{F}$ is
flat at $x'$ over $S$, see
Morphisms, Lemma \ref{morphisms-lemma-flat-permanence}.
In other words $X_s \cap V \subset U$ is an open neighbourhood
of $x$ in $U$.
\end{proof}

\begin{lemma}
\label{lemma-finite-type-flat-at-point}
Let $f : X \to S$ be a morphism of schemes.
Let $\mathcal{F}$ be a quasi-coherent sheaf on $X$.
Let $x \in X$ with image $s \in S$.
Assume that
\begin{enumerate}
\item $f$ is locally of finite type,
\item $\mathcal{F}$ is of finite type, and
\item $\mathcal{F}$ is flat at $x$ over $S$.
\end{enumerate}
Then there exists an elementary \'etale neighbourhood $(S', s') \to (S, s)$
and an open subscheme
$$
V \subset X \times_S \Spec(\mathcal{O}_{S', s'})
$$
which contains the unique point of
$X \times_S \Spec(\mathcal{O}_{S', s'})$ mapping to $x$
such that the pullback of $\mathcal{F}$ to $V$ is flat over
$\mathcal{O}_{S', s'}$.
\end{lemma}

\begin{proof}
(The only difference between this and
Proposition \ref{proposition-finite-type-flat-at-point}
is that we do not assume $f$ is of finite presentation.)
The question is local on $X$ and $S$, hence we may assume $X$ and $S$
are affine. Write $X = \Spec(B)$, $S = \Spec(A)$ and write
$B = A[x_1, \ldots, x_n]/I$. In other words we obtain a closed immersion
$i : X \to \mathbf{A}^n_S$. Denote $t = i(x) \in \mathbf{A}^n_S$.
We may apply
Proposition \ref{proposition-finite-type-flat-at-point}
to $\mathbf{A}^n_S \to S$, the sheaf $i_*\mathcal{F}$
and the point $t$. We obtain an elementary
\'etale neighbourhood $(S', s') \to (S, s)$ and an open subscheme
$$
W \subset \mathbf{A}^n_{\mathcal{O}_{S', s'}}
$$
such that the pullback of $i_*\mathcal{F}$ to $W$ is flat over
$\mathcal{O}_{S', s'}$. This means that
$V := W \cap \big(X \times_S \Spec(\mathcal{O}_{S', s'})\big)$
is the desired open subscheme.
\end{proof}

\begin{lemma}
\label{lemma-finite-type-flat-along-fibre}
Let $f : X \to S$ be a morphism of schemes.
Let $\mathcal{F}$ be a quasi-coherent sheaf on $X$.
Let $s \in S$.
Assume that
\begin{enumerate}
\item $f$ is of finite presentation,
\item $\mathcal{F}$ is of finite type, and
\item $\mathcal{F}$ is flat over $S$ at every point of the fibre $X_s$.
\end{enumerate}
Then there exists an elementary \'etale neighbourhood $(S', s') \to (S, s)$
and an open subscheme
$$
V \subset X \times_S \Spec(\mathcal{O}_{S', s'})
$$
which contains the fibre $X_s = X \times_S s'$ such that the pullback
of $\mathcal{F}$ to $V$ is an $\mathcal{O}_V$-module
of finite presentation and flat over $\mathcal{O}_{S', s'}$.
\end{lemma}

\begin{proof}
For every point $x \in X_s$ we can use
Proposition \ref{proposition-finite-type-flat-at-point}
to find an elementary \'etale neighbourhood $(S_x, s_x) \to (S, s)$
and an open $V_x \subset X \times_S \Spec(\mathcal{O}_{S_x, s_x})$
such that $x \in X_s = X \times_S s_x$ is contained in $V_x$ and such that
the pullback of $\mathcal{F}$ to $V_x$ is an
$\mathcal{O}_{V_x}$-module of finite presentation and flat over
$\mathcal{O}_{S_x, s_x}$. In particular we may view the fibre
$(V_x)_{s_x}$ as an open neighbourhood of $x$ in $X_s$.
Because $X_s$ is quasi-compact we can find a finite number of points
$x_1, \ldots, x_n \in X_s$ such that $X_s$ is the union of
the $(V_{x_i})_{s_{x_i}}$. Choose an elementary \'etale neighbourhood
$(S' , s') \to (S, s)$ which dominates each of the neighbourhoods
$(S_{x_i}, s_{x_i})$, see
More on Morphisms,
Lemma \ref{more-morphisms-lemma-elementary-etale-neighbourhoods}.
Set $V = \bigcup V_i$ where $V_i$ is the inverse images of the open
$V_{x_i}$ via the morphism
$$
X \times_S \Spec(\mathcal{O}_{S', s'})
\longrightarrow
X \times_S \Spec(\mathcal{O}_{S_{x_i}, s_{x_i}})
$$
By construction $V$ contains $X_s$ and by construction the pullback
of $\mathcal{F}$ to $V$ is an $\mathcal{O}_V$-module
of finite presentation and flat over $\mathcal{O}_{S', s'}$.
\end{proof}

\begin{lemma}
\label{lemma-finite-type-flat-along-fibre-variant}
Let $f : X \to S$ be a morphism of schemes.
Let $\mathcal{F}$ be a quasi-coherent sheaf on $X$.
Let $s \in S$.
Assume that
\begin{enumerate}
\item $f$ is of finite type,
\item $\mathcal{F}$ is of finite type, and
\item $\mathcal{F}$ is flat over $S$ at every point of the fibre $X_s$.
\end{enumerate}
Then there exists an elementary \'etale neighbourhood $(S', s') \to (S, s)$
and an open subscheme
$$
V \subset X \times_S \Spec(\mathcal{O}_{S', s'})
$$
which contains the fibre $X_s = X \times_S s'$ such that the pullback
of $\mathcal{F}$ to $V$ is flat over $\mathcal{O}_{S', s'}$.
\end{lemma}

\begin{proof}
(The only difference between this and
Lemma \ref{lemma-finite-type-flat-along-fibre}
is that we do not assume $f$ is of finite presentation.)
For every point $x \in X_s$ we can use
Lemma \ref{lemma-finite-type-flat-at-point}
to find an elementary \'etale neighbourhood $(S_x, s_x) \to (S, s)$
and an open $V_x \subset X \times_S \Spec(\mathcal{O}_{S_x, s_x})$
such that $x \in X_s = X \times_S s_x$ is contained in $V_x$ and such that
the pullback of $\mathcal{F}$ to $V_x$ is flat over
$\mathcal{O}_{S_x, s_x}$. In particular we may view the fibre
$(V_x)_{s_x}$ as an open neighbourhood of $x$ in $X_s$.
Because $X_s$ is quasi-compact we can find a finite number of points
$x_1, \ldots, x_n \in X_s$ such that $X_s$ is the union of
the $(V_{x_i})_{s_{x_i}}$. Choose an elementary \'etale neighbourhood
$(S' , s') \to (S, s)$ which dominates each of the neighbourhoods
$(S_{x_i}, s_{x_i})$, see
More on Morphisms,
Lemma \ref{more-morphisms-lemma-elementary-etale-neighbourhoods}.
Set $V = \bigcup V_i$ where $V_i$ is the inverse images of the open
$V_{x_i}$ via the morphism
$$
X \times_S \Spec(\mathcal{O}_{S', s'})
\longrightarrow
X \times_S \Spec(\mathcal{O}_{S_{x_i}, s_{x_i}})
$$
By construction $V$ contains $X_s$ and by construction the pullback
of $\mathcal{F}$ to $V$ is flat over $\mathcal{O}_{S', s'}$.
\end{proof}

\begin{lemma}
\label{lemma-finite-type-flat-at-point-X}
Let $S$ be a scheme. Let $X$ be locally of finite type over $S$.
Let $x \in X$ with image $s \in S$.
If $X$ is flat at $x$ over $S$, then there exists an elementary
\'etale neighbourhood $(S', s') \to (S, s)$ and an open subscheme
$$
V \subset X \times_S \Spec(\mathcal{O}_{S', s'})
$$
which contains the unique point of
$X \times_S \Spec(\mathcal{O}_{S', s'})$ mapping to $x$
such that $V \to \Spec(\mathcal{O}_{S', s'})$
is flat and of finite presentation.
\end{lemma}

\begin{proof}
The question is local on $X$ and $S$, hence we may assume $X$ and $S$
are affine. Write $X = \Spec(B)$, $S = \Spec(A)$ and write
$B = A[x_1, \ldots, x_n]/I$. In other words we obtain a closed immersion
$i : X \to \mathbf{A}^n_S$. Denote $t = i(x) \in \mathbf{A}^n_S$.
We may apply
Proposition \ref{proposition-finite-type-flat-at-point}
to $\mathbf{A}^n_S \to S$, the sheaf $\mathcal{F} = i_*\mathcal{O}_X$
and the point $t$. We obtain an elementary
\'etale neighbourhood $(S', s') \to (S, s)$ and an open subscheme
$$
W \subset \mathbf{A}^n_{\mathcal{O}_{S', s'}}
$$
such that the pullback of $i_*\mathcal{O}_X$ is flat and of finite
presentation. This means that
$V := W \cap \big(X \times_S \Spec(\mathcal{O}_{S', s'})\big)$
is the desired open subscheme.
\end{proof}

\begin{lemma}
\label{lemma-finite-type-flat-at-point-local}
Let $f : X \to S$ be a morphism which is locally of finite presentation.
Let $\mathcal{F}$ be a quasi-coherent $\mathcal{O}_X$-module of finite type.
If $x \in X$ and $\mathcal{F}$ is flat at $x$ over $S$, then
$\mathcal{F}_x$ is an $\mathcal{O}_{X, x}$-module of finite presentation.
\end{lemma}

\begin{proof}
Let $s = f(x)$. By
Proposition \ref{proposition-finite-type-flat-at-point}
there exists an elementary \'etale neighbourhood $(S', s') \to (S, s)$
such that the pullback of $\mathcal{F}$ to
$X \times_S \Spec(\mathcal{O}_{S', s'})$ is of
finite presentation in a neighbourhood of the point $x' \in X_{s'} = X_s$
corresponding to $x$. The ring map
$$
\mathcal{O}_{X, x} \longrightarrow
\mathcal{O}_{X \times_S \Spec(\mathcal{O}_{S', s'}), x'}
=
\mathcal{O}_{X \times_S S', x'}
$$
is flat and local as a localization of an \'etale ring map. Hence
$\mathcal{F}_x$ is of finite presentation over $\mathcal{O}_{X, x}$
by descent, see
Algebra, Lemma \ref{algebra-lemma-descend-properties-modules}
(and also that a flat local ring map is faithfully flat, see
Algebra, Lemma \ref{algebra-lemma-local-flat-ff}).
\end{proof}

\begin{lemma}
\label{lemma-finite-type-flat-at-point-local-X}
Let $f : X \to S$ be a morphism which is locally of finite type.
Let $x \in X$ with image $s \in S$. If $f$ is flat at $x$ over $S$, then
$\mathcal{O}_{X, x}$ is essentially of finite presentation over
$\mathcal{O}_{S, s}$.
\end{lemma}

\begin{proof}
We may assume $X$ and $S$ affine. Write $X = \Spec(B)$,
$S = \Spec(A)$ and write $B = A[x_1, \ldots, x_n]/I$.
In other words we obtain a closed immersion $i : X \to \mathbf{A}^n_S$.
Denote $t = i(x) \in \mathbf{A}^n_S$. We may apply
Lemma \ref{lemma-finite-type-flat-at-point-local}
to $\mathbf{A}^n_S \to S$, the sheaf $\mathcal{F} = i_*\mathcal{O}_X$
and the point $t$. We conclude that $\mathcal{O}_{X, x}$ is
of finite presentation over $\mathcal{O}_{\mathbf{A}^n_S, t}$
which implies what we want.
\end{proof}







\section{Extending properties from an open}
\label{section-extending-properties}

\noindent
In this section we collect a number of results of the form: If $f : X \to S$
is a flat morphism of schemes and $f$ satisfies some property over a dense
open of $S$, then $f$ satisfies the same property over all of $S$.

\begin{lemma}
\label{lemma-flat-finite-type-finitely-presented-over-dense-open}
\begin{slogan}
$S$-flat and finite type extensions of finitely presented modules
on a (good) open are also $X$-finitely presented.
\end{slogan}
Let $f : X \to S$ be a morphism of schemes. Let $\mathcal{F}$ be a
quasi-coherent $\mathcal{O}_X$-module. Let $U \subset S$ be open.
Assume
\begin{enumerate}
\item $f$ is locally of finite presentation,
\item $\mathcal{F}$ is of finite type and flat over $S$,
\item $U \subset S$ is retrocompact and scheme theoretically dense,
\item $\mathcal{F}|_{f^{-1}U}$ is of finite presentation.
\end{enumerate}
Then $\mathcal{F}$ is of finite presentation.
\end{lemma}

\begin{proof}
The problem is local on $X$ and $S$, hence we may assume $X$ and $S$ affine.
Write $S = \Spec(A)$ and $X = \Spec(B)$. Let $N$ be a finite $B$-module such
that $\mathcal{F}$ is the quasi-coherent sheaf associated to $N$.
We have $U = D(f_1) \cup \ldots \cup D(f_n)$ for some $f_i \in A$, see
Algebra, Lemma \ref{algebra-lemma-qc-open}.
As $U$ is schematically dense the map
$A \to A_{f_1} \times \ldots \times A_{f_n}$ is injective.
Pick a prime $\mathfrak q \subset B$ lying over $\mathfrak p \subset A$
corresponding to $x \in X$ mapping to $s \in S$.
By Lemma \ref{lemma-finite-type-flat-at-point-local}
the module $N_\mathfrak q$ is of finite presentation over $B_\mathfrak q$.
Choose a surjection $\varphi : B^{\oplus m} \to N$ of $B$-modules.
Choose $k_1, \ldots, k_t \in \Ker(\varphi)$ and
set $N' = B^{\oplus m}/\sum Bk_j$. There is a canonical surjection
$N' \to N$ and $N$ is the filtered colimit of the $B$-modules $N'$
constructed in this manner. Thus we see that we can choose
$k_1, \ldots, k_t$ such that (a) $N'_{f_i} \cong N_{f_i}$, $i = 1, \ldots, n$
and (b) $N'_\mathfrak q \cong N_\mathfrak q$.
This in particular implies that $N'_\mathfrak q$ is flat over $A$.
By openness of flatness, see
Algebra, Theorem \ref{algebra-theorem-openness-flatness}
we conclude that there exists a $g \in B$, $g \not \in \mathfrak q$
such that $N'_g$ is flat over $A$. Consider the commutative diagram
$$
\xymatrix{
N'_g \ar[r] \ar[d] & N_g \ar[d] \\
\prod N'_{gf_i} \ar[r] & \prod N_{gf_i}
}
$$
The bottom arrow is an isomorphism by choice of $k_1, \ldots, k_t$.
The left vertical arrow is an injective map as
$A \to \prod A_{f_i}$ is injective and $N'_g$ is flat over $A$.
Hence the top horizontal arrow is injective, hence an isomorphism.
This proves that $N_g$ is of finite presentation over $B_g$.
We conclude by applying
Algebra, Lemma \ref{algebra-lemma-cover}.
\end{proof}

\begin{lemma}
\label{lemma-flat-finite-type-finitely-presented-over-dense-open-X}
Let $f : X \to S$ be a morphism of schemes. Let $U \subset S$ be open.
Assume
\begin{enumerate}
\item $f$ is locally of finite type and flat,
\item $U \subset S$ is retrocompact and scheme theoretically dense,
\item $f|_{f^{-1}U} : f^{-1}U \to U$ is locally of finite presentation.
\end{enumerate}
Then $f$ is of locally of finite presentation.
\end{lemma}

\begin{proof}
The question is local on $X$ and $S$, hence we may assume $X$ and
$S$ affine. Choose a closed immersion $i : X \to \mathbf{A}^n_S$
and apply
Lemma \ref{lemma-flat-finite-type-finitely-presented-over-dense-open}
to $i_*\mathcal{O}_X$. Some details omitted.
\end{proof}

\begin{lemma}
\label{lemma-flat-finite-presentation-dimension-over-dense-open}
Let $f : X \to S$ be a morphism of schemes which is flat and locally
of finite type. Let $U \subset S$ be a dense open such that
$X_U \to U$ has relative dimension $\leq e$, see
Morphisms, Definition \ref{morphisms-definition-relative-dimension-d}.
If also either
\begin{enumerate}
\item $f$ is locally of finite presentation, or
\item $U \subset S$ is retrocompact,
\end{enumerate}
then $f$ has relative dimension $\leq e$.
\end{lemma}

\begin{proof}
Proof in case (1). Let $W \subset X$ be the open subscheme constructed
and studied in More on Morphisms, Lemmas
\ref{more-morphisms-lemma-flat-finite-presentation-CM-open} and
\ref{more-morphisms-lemma-flat-finite-presentation-CM-pieces}.
Note that every generic point of every fibre is contained in $W$,
hence it suffices to prove the result for $W$. Since
$W = \bigcup_{d \geq 0} U_d$, it suffices to prove that $U_d = \emptyset$
for $d > e$. Since $f$ is flat and locally of finite presentation it is open
hence $f(U_d)$ is open (Morphisms, Lemma \ref{morphisms-lemma-fppf-open}).
Thus if $U_d$ is not empty, then $f(U_d) \cap U \not = \emptyset$ as
desired.

\medskip\noindent
Proof in case (2). We may replace $S$ by its reduction. Then $U$ is
scheme theoretically dense. Hence $f$ is locally of finite presentation
by Lemma \ref{lemma-flat-finite-type-finitely-presented-over-dense-open-X}.
In this way we reduce to case (1).
\end{proof}

\begin{lemma}
\label{lemma-proper-flat-finite-over-dense-open}
Let $f : X \to S$ be a morphism of schemes which is flat and proper.
Let $U \subset S$ be a dense open such that $X_U \to U$ is finite.
If also either $f$ is locally of finite presentation or
$U \subset S$ is retrocompact, then $f$ is finite.
\end{lemma}

\begin{proof}
By Lemma \ref{lemma-flat-finite-presentation-dimension-over-dense-open}
the fibres of $f$ have dimension zero.
Hence $f$ is quasi-finite
(Morphisms, Lemma \ref{morphisms-lemma-locally-quasi-finite-rel-dimension-0})
whence has finite fibres
(Morphisms, Lemma \ref{morphisms-lemma-quasi-finite}).
Hence $f$ is finite by
More on Morphisms, Lemma \ref{more-morphisms-lemma-characterize-finite}.
\end{proof}

\begin{lemma}
\label{lemma-zariski}
Let $f : X \to S$ be a morphism of schemes and $U \subset S$ an open. If
\begin{enumerate}
\item $f$ is separated, locally of finite type, and flat,
\item $f^{-1}(U) \to U$ is an isomorphism, and
\item $U \subset S$ is retrocompact and scheme theoretically dense,
\end{enumerate}
then $f$ is an open immersion.
\end{lemma}

\begin{proof}
By Lemma \ref{lemma-flat-finite-type-finitely-presented-over-dense-open-X}
the morphism $f$ is locally of finite presentation.
The image $f(X) \subset S$ is open
(Morphisms, Lemma \ref{morphisms-lemma-fppf-open})
hence we may replace $S$ by $f(X)$. Thus we have to prove that
$f$ is an isomorphism. We may assume $S$ is affine. We can reduce
to the case that $X$ is quasi-compact because it suffices to show
that any quasi-compact open $X' \subset X$ whose image is $S$
maps isomorphically to $S$. Thus we may assume $f$ is quasi-compact.
All the fibers of $f$ have dimension $0$, see
Lemma \ref{lemma-flat-finite-presentation-dimension-over-dense-open}.
Hence $f$ is quasi-finite, see
Morphisms, Lemma \ref{morphisms-lemma-locally-quasi-finite-rel-dimension-0}.
Let $s \in S$. Choose an elementary \'etale
neighbourhood $g : (T, t) \to (S, s)$ such that $X \times_S T = V \amalg W$
with $V \to T$ finite and $W_t = \emptyset$, see
More on Morphisms, Lemma
\ref{more-morphisms-lemma-etale-splits-off-quasi-finite-part}.
Denote $\pi : V \amalg W \to T$ the given morphism. Since $\pi$ is
flat and locally of finite presentation, we see that $\pi(V)$ is
open in $T$ (Morphisms, Lemma \ref{morphisms-lemma-fppf-open}).
After shrinking $T$ we may assume that $T = \pi(V)$.
Since $f$ is an isomorphism over $U$ we see that $\pi$ is an
isomorphism over $g^{-1}U$. Since $\pi(V) = T$ this implies
that $\pi^{-1}g^{-1}U$ is contained in $V$.
By Morphisms, Lemma
\ref{morphisms-lemma-flat-morphism-scheme-theoretically-dense-open}
we see that $\pi^{-1}g^{-1}U \subset V \amalg W$ is scheme theoretically
dense. Hence we deduce that $W = \emptyset$.
Thus $X \times_S T = V$ is finite over $T$.
This implies that $f$ is finite (after replacing $S$ by an
open neighbourhood of $s$), for example by
Descent, Lemma \ref{descent-lemma-descending-property-finite}.
Then $f$ is finite locally free
(Morphisms, Lemma \ref{morphisms-lemma-finite-flat})
and after shrinking $S$ to a smaller open neighbourhood of $s$
we see that $f$ is finite locally free of some degree $d$
(Morphisms, Lemma \ref{morphisms-lemma-finite-locally-free}).
But $d = 1$ as is clear from the fact that the degree is $1$ over
the dense open $U$. Hence $f$ is an isomorphism.
\end{proof}





\section{Flat finitely presented modules}
\label{section-finitely-presented-flat}

\noindent
In some cases given a ring map $R \to S$ of finite presentation and
a finitely presented $S$-module $N$ the flatness of $N$ over $R$ implies
that $N$ is projective as an $R$-module, at least after replacing $S$
by an \'etale extension. In this section we collect a some results
of this nature.

\begin{lemma}
\label{lemma-induction-step-fp}
Let $R$ be a ring. Let $R \to S$ be a finitely presented
flat ring map with geometrically integral fibres. Let
$\mathfrak q \subset S$ be a prime ideal lying over the prime
$\mathfrak r \subset R$. Set $\mathfrak p = \mathfrak r S$.
Let $N$ be a finitely presented $S$-module.
There exists $r \geq 0$ and an $S$-module map
$$
\alpha : S^{\oplus r} \longrightarrow N
$$
such that
$\alpha : \kappa(\mathfrak p)^{\oplus r} \to N \otimes_S \kappa(\mathfrak p)$
is an isomorphism. For any such $\alpha$ the following are equivalent:
\begin{enumerate}
\item $N_{\mathfrak q}$ is $R$-flat,
\item there exists an $f \in R$, $f \not \in \mathfrak r$ such that
$\alpha_f : S_f^{\oplus r} \to N_f$ is $R_f$-universally injective and
a $g \in S$, $g \not \in \mathfrak q$ such that $\Coker(\alpha)_g$
is $R$-flat,
\item $\alpha_{\mathfrak r}$ is $R_{\mathfrak r}$-universally injective and
$\Coker(\alpha)_{\mathfrak q}$ is $R$-flat
\item $\alpha_{\mathfrak r}$ is injective and
$\Coker(\alpha)_{\mathfrak q}$ is $R$-flat,
\item $\alpha_{\mathfrak p}$ is an isomorphism and
$\Coker(\alpha)_{\mathfrak q}$ is $R$-flat, and
\item $\alpha_{\mathfrak q}$ is injective and
$\Coker(\alpha)_{\mathfrak q}$ is $R$-flat.
\end{enumerate}
\end{lemma}

\begin{proof}
To obtain $\alpha$ set
$r = \dim_{\kappa(\mathfrak p)} N \otimes_S \kappa(\mathfrak p)$ and pick
$x_1, \ldots, x_r \in N$ which form a basis of
$N \otimes_S \kappa(\mathfrak p)$. Define
$\alpha(s_1, \ldots, s_r) = \sum s_i x_i$. This proves the existence.

\medskip\noindent
Fix a choice of $\alpha$.
We may apply
Lemma \ref{lemma-induction-step}
to the map
$\alpha_{\mathfrak r} : S_{\mathfrak r}^{\oplus r} \to N_{\mathfrak r}$.
Hence we see that (1), (3), (4), (5), and (6) are all equivalent.
Since it is also clear that (2) implies (3) we see that all we have to
do is show that (1) implies (2).

\medskip\noindent
Assume (1). By openness of flatness, see
Algebra, Theorem \ref{algebra-theorem-openness-flatness},
the set
$$
U_1 = \{\mathfrak q' \subset S \mid N_{\mathfrak q'}\text{ is flat over }R\}
$$
is open in $\Spec(S)$. It contains $\mathfrak q$ by assumption
and hence $\mathfrak p$. Because $S^{\oplus r}$ and $N$ are finitely presented
$S$-modules the set
$$
U_2 = \{\mathfrak q' \subset S \mid
\alpha_{\mathfrak q'}\text{ is an isomorphism}\}
$$
is open in $\Spec(S)$, see
Algebra, Lemma \ref{algebra-lemma-map-between-finitely-presented}.
It contains $\mathfrak p$ by (5). As $R \to S$
is finitely presented and flat the map
$\Phi : \Spec(S) \to \Spec(R)$ is open, see
Algebra, Proposition \ref{algebra-proposition-fppf-open}.
For any prime $\mathfrak r' \in \Phi(U_1 \cap U_2)$ we see that
there exists a prime $\mathfrak q'$ lying over $\mathfrak r'$ such that
$N_{\mathfrak q'}$ is flat and such that $\alpha_{\mathfrak q'}$ is
an isomorphism, which implies that $\alpha \otimes \kappa(\mathfrak p')$
is an isomorphism where $\mathfrak p' = \mathfrak r' S$. Thus
$\alpha_{\mathfrak r'}$ is $R_{\mathfrak r'}$-universally injective
by the implication (1) $\Rightarrow$ (3).
Hence if we pick $f \in R$, $f \not \in \mathfrak r$ such that
$D(f) \subset \Phi(U_1 \cap U_2)$ then we conclude that
$\alpha_f$ is $R_f$-universally injective, see
Algebra, Lemma \ref{algebra-lemma-universally-injective-check-stalks}.
The same reasoning also shows that for any
$\mathfrak q' \in U_1 \cap \Phi^{-1}(\Phi(U_1 \cap U_2))$
the module $\Coker(\alpha)_{\mathfrak q'}$ is $R$-flat.
Note that $\mathfrak q \in U_1 \cap \Phi^{-1}(\Phi(U_1 \cap U_2))$.
Hence we can find a $g \in S$, $g \not \in \mathfrak q$ such
that $D(g) \subset U_1 \cap \Phi^{-1}(\Phi(U_1 \cap U_2))$
and we win.
\end{proof}

\begin{lemma}
\label{lemma-complete-devissage-flat-finitely-presented-module}
Let $R \to S$ be a ring map of finite presentation.
Let $N$ be a finitely presented $S$-module flat over $R$.
Let $\mathfrak r \subset R$ be a prime ideal.
Assume there exists a complete d\'evissage of $N/S/R$ over $\mathfrak r$.
Then there exists an $f \in R$, $f \not \in \mathfrak r$
such that
$$
N_f \cong B_1^{\oplus r_1} \oplus \ldots \oplus B_n^{\oplus r_n}
$$
as $R$-modules where each $B_i$ is a smooth $R_f$-algebra with geometrically
irreducible fibres. Moreover, $N_f$ is projective as an $R_f$-module.
\end{lemma}

\begin{proof}
Let $(A_i, B_i, M_i, \alpha_i)_{i = 1, \ldots, n}$ be the given
complete d\'evissage. We prove the lemma by induction on $n$.
Note that the assertions of the lemma are entirely about the structure
of $N$ as an $R$-module. Hence we may replace $N$ by $M_1$, and we
may think of $M_1$ as a $B_1$-module. See
Remark \ref{remark-finite-presentation}
in order to see why $M_1$ is of finite presentation as a $B_1$-module. By
Lemma \ref{lemma-induction-step-fp}
we may, after replacing $R$ by $R_f$ for some
$f \in R$, $f \not \in \mathfrak r$, assume
the map $\alpha_1 : B_1^{\oplus r_1} \to M_1$ is $R$-universally injective.
Since $M_1$ and $B_1^{\oplus r_1}$ are $R$-flat and finitely presented as
$B_1$-modules we see that $\Coker(\alpha_1)$ is $R$-flat
(Algebra, Lemma \ref{algebra-lemma-ui-flat-domain})
and finitely presented as a $B_1$-module. Note that
$(A_i, B_i, M_i, \alpha_i)_{i = 2, \ldots, n}$ is a complete
d\'evissage of $\Coker(\alpha_1)$. Hence the induction hypothesis
implies that, after replacing
$R$ by $R_f$ for some $f \in R$, $f \not \in \mathfrak r$,
we may assume that $\Coker(\alpha_1)$ has a decomposition
as in the lemma and is projective. In particular
$M_1 = B_1^{\oplus r_1} \oplus \Coker(\alpha_1)$.
This proves the statement regarding the decomposition.
The statement on projectivity follows as $B_1$ is projective as
an $R$-module by
Lemma \ref{lemma-fibres-irreducible-flat-projective-nonnoetherian}.
\end{proof}

\begin{remark}
\label{remark-complete-devissage-flat-finitely-presented-module}
There is a variant of
Lemma \ref{lemma-complete-devissage-flat-finitely-presented-module}
where we weaken the flatness condition by assuming only that $N$
is flat at some given prime $\mathfrak q$ lying over $\mathfrak r$
but where we strengthen the d\'evissage condition by assuming
the existence of a complete d\'evissage {\it at $\mathfrak q$}. Compare with
Lemma \ref{lemma-complete-devissage-flat-finite-type-module}.
\end{remark}

\noindent
The following is the main result of this section.

\begin{proposition}
\label{proposition-finite-presentation-flat-at-point}
Let $f : X \to S$ be a morphism of schemes.
Let $\mathcal{F}$ be a quasi-coherent sheaf on $X$.
Let $x \in X$ with image $s \in S$.
Assume that
\begin{enumerate}
\item $f$ is locally of finite presentation,
\item $\mathcal{F}$ is of finite presentation, and
\item $\mathcal{F}$ is flat at $x$ over $S$.
\end{enumerate}
Then there exists a commutative diagram of pointed schemes
$$
\xymatrix{
(X, x) \ar[d] & (X', x') \ar[l]^g \ar[d] \\
(S, s) & (S', s') \ar[l]
}
$$
whose horizontal arrows are elementary \'etale neighbourhoods
such that $X'$, $S'$ are affine and such that
$\Gamma(X', g^*\mathcal{F})$ is a projective
$\Gamma(S', \mathcal{O}_{S'})$-module.
\end{proposition}

\begin{proof}
By openness of flatness, see
More on Morphisms, Theorem \ref{more-morphisms-theorem-openness-flatness}
we may replace $X$ by an open neighbourhood of $x$ and assume that
$\mathcal{F}$ is flat over $S$. Next, we apply
Proposition \ref{proposition-existence-complete-at-x}
to find a diagram as in the statement of the proposition such
that $g^*\mathcal{F}/X'/S'$ has a complete d\'evissage over $s'$.
(In particular $S'$ and $X'$ are affine.) By
Morphisms, Lemma \ref{morphisms-lemma-flat-permanence}
we see that $g^*\mathcal{F}$ is flat over $S$ and by
Lemma \ref{lemma-etale-flat-up-down}
we see that it is flat over $S'$. Via
Remark \ref{remark-same-notion}
we deduce that
$$
\Gamma(X', g^*\mathcal{F})/
\Gamma(X', \mathcal{O}_{X'})/
\Gamma(S', \mathcal{O}_{S'})
$$
has a complete d\'evissage over the prime of $\Gamma(S', \mathcal{O}_{S'})$
corresponding to $s'$. Thus
Lemma \ref{lemma-complete-devissage-flat-finitely-presented-module}
implies that the result of the proposition holds after replacing
$S'$ by a standard open neighbourhood of $s'$.
\end{proof}

\noindent
In the rest of this section we prove a number of variants
on this result. The first is a ``global'' version.

\begin{lemma}
\label{lemma-finite-presentation-flat-along-fibre}
Let $f : X \to S$ be a morphism of schemes.
Let $\mathcal{F}$ be a quasi-coherent sheaf on $X$.
Let $s \in S$.
Assume that
\begin{enumerate}
\item $f$ is of finite presentation,
\item $\mathcal{F}$ is of finite presentation, and
\item $\mathcal{F}$ is flat over $S$ at every point of the fibre $X_s$.
\end{enumerate}
Then there exists an elementary \'etale neighbourhood
$(S', s') \to (S, s)$ and a commutative diagram of schemes
$$
\xymatrix{
X \ar[d] & X' \ar[l]^g \ar[d] \\
S & S' \ar[l]
}
$$
such that $g$ is \'etale, $X_s \subset g(X')$, the schemes
$X'$, $S'$ are affine, and such that
$\Gamma(X', g^*\mathcal{F})$ is a projective
$\Gamma(S', \mathcal{O}_{S'})$-module.
\end{lemma}

\begin{proof}
For every point $x \in X_s$ we can use
Proposition \ref{proposition-finite-presentation-flat-at-point}
to find a commutative diagram
$$
\xymatrix{
(X, x) \ar[d] & (Y_x, y_x) \ar[l]^{g_x} \ar[d] \\
(S, s) & (S_x, s_x) \ar[l]
}
$$
whose horizontal arrows are elementary \'etale neighbourhoods
such that $Y_x$, $S_x$ are affine and such that
$\Gamma(Y_x, g_x^*\mathcal{F})$ is a projective
$\Gamma(S_x, \mathcal{O}_{S_x})$-module. In particular
$g_x(Y_x) \cap X_s$ is an open neighbourhood of $x$ in $X_s$.
Because $X_s$ is quasi-compact we can find a finite number of points
$x_1, \ldots, x_n \in X_s$ such that $X_s$ is the union of
the $g_{x_i}(Y_{x_i}) \cap X_s$. Choose an elementary \'etale neighbourhood
$(S' , s') \to (S, s)$ which dominates each of the neighbourhoods
$(S_{x_i}, s_{x_i})$, see
More on Morphisms,
Lemma \ref{more-morphisms-lemma-elementary-etale-neighbourhoods}.
We may also assume that $S'$ is affine.
Set $X' = \coprod Y_{x_i} \times_{S_{x_i}} S'$ and endow it with the
obvious morphism $g : X' \to X$.
By construction $g(X')$ contains $X_s$ and
$$
\Gamma(X', g^*\mathcal{F})
=
\bigoplus \Gamma(Y_{x_i}, g_{x_i}^*\mathcal{F})
\otimes_{\Gamma(S_{x_i}, \mathcal{O}_{S_{x_i}})}
\Gamma(S', \mathcal{O}_{S'}).
$$
This is a projective $\Gamma(S', \mathcal{O}_{S'})$-module, see
Algebra, Lemma \ref{algebra-lemma-ascend-properties-modules}.
\end{proof}

\noindent
The following two lemmas are reformulations of the results
above in case $\mathcal{F} = \mathcal{O}_X$.

\begin{lemma}
\label{lemma-finite-presentation-flat-at-point-X}
Let $f : X \to S$ be locally of finite presentation.
Let $x \in X$ with image $s \in S$.
If $f$ is flat at $x$ over $S$, then there exists a commutative
diagram of pointed schemes
$$
\xymatrix{
(X, x) \ar[d] & (X', x') \ar[l]^g \ar[d] \\
(S, s) & (S', s') \ar[l]
}
$$
whose horizontal arrows are elementary \'etale neighbourhoods
such that $X'$, $S'$ are affine and such that
$\Gamma(X', \mathcal{O}_{X'})$ is a projective
$\Gamma(S', \mathcal{O}_{S'})$-module.
\end{lemma}

\begin{proof}
This is a special case of
Proposition \ref{proposition-finite-presentation-flat-at-point}.
\end{proof}

\begin{lemma}
\label{lemma-finite-presentation-flat-along-fibre-X}
Let $f : X \to S$ be of finite presentation.
Let $s \in S$.
If $X$ is flat over $S$ at all points of $X_s$, then
there exists an elementary \'etale neighbourhood
$(S', s') \to (S, s)$ and a commutative diagram of schemes
$$
\xymatrix{
X \ar[d] & X' \ar[l]^g \ar[d] \\
S & S' \ar[l]
}
$$
with $g$ \'etale, $X_s \subset g(X')$, such that $X'$, $S'$
are affine, and such that
$\Gamma(X', \mathcal{O}_{X'})$ is a projective
$\Gamma(S', \mathcal{O}_{S'})$-module.
\end{lemma}

\begin{proof}
This is a special case of
Lemma \ref{lemma-finite-presentation-flat-along-fibre}.
\end{proof}

\noindent
The following lemmas explain consequences of
Proposition \ref{proposition-finite-presentation-flat-at-point}
in case we only assume the morphism and the sheaf are of finite type
(and not necessarily of finite presentation).

\begin{lemma}
\label{lemma-finite-type-flat-at-point-free}
Let $f : X \to S$ be a morphism of schemes.
Let $\mathcal{F}$ be a quasi-coherent sheaf on $X$.
Let $x \in X$ with image $s \in S$.
Assume that
\begin{enumerate}
\item $f$ is locally of finite presentation,
\item $\mathcal{F}$ is of finite type, and
\item $\mathcal{F}$ is flat at $x$ over $S$.
\end{enumerate}
Then there exists an elementary \'etale neighbourhood $(S', s') \to (S, s)$
and a commutative diagram of pointed schemes
$$
\xymatrix{
(X, x) \ar[d] & (X', x') \ar[l]^g \ar[d] \\
(S, s) & (\Spec(\mathcal{O}_{S', s'}), s') \ar[l]
}
$$
such that $X' \to X \times_S \Spec(\mathcal{O}_{S', s'})$
is \'etale, $\kappa(x) = \kappa(x')$, the scheme $X'$ is
affine of finite presentation over $\mathcal{O}_{S', s'}$,
the sheaf $g^*\mathcal{F}$ is of finite presentation over $\mathcal{O}_{X'}$,
and such that $\Gamma(X', g^*\mathcal{F})$ is a free
$\mathcal{O}_{S', s'}$-module.
\end{lemma}

\begin{proof}
To prove the lemma we may replace $(S, s)$ by any elementary \'etale
neighbourhood, and we may also replace $S$ by
$\Spec(\mathcal{O}_{S, s})$. Hence by
Proposition \ref{proposition-finite-type-flat-at-point}
we may assume that $\mathcal{F}$ is finitely presented and flat over
$S$ in a neighbourhood of $x$. In this case the result follows from
Proposition \ref{proposition-finite-presentation-flat-at-point}
because
Algebra, Theorem \ref{algebra-theorem-projective-free-over-local-ring}
assures us that projective $=$ free over a local ring.
\end{proof}

\begin{lemma}
\label{lemma-finite-type-flat-at-point-free-variant}
Let $f : X \to S$ be a morphism of schemes.
Let $\mathcal{F}$ be a quasi-coherent sheaf on $X$.
Let $x \in X$ with image $s \in S$.
Assume that
\begin{enumerate}
\item $f$ is locally of finite type,
\item $\mathcal{F}$ is of finite type, and
\item $\mathcal{F}$ is flat at $x$ over $S$.
\end{enumerate}
Then there exists an elementary \'etale neighbourhood $(S', s') \to (S, s)$
and a commutative diagram of pointed schemes
$$
\xymatrix{
(X, x) \ar[d] & (X', x') \ar[l]^g \ar[d] \\
(S, s) & (\Spec(\mathcal{O}_{S', s'}), s') \ar[l]
}
$$
such that $X' \to X \times_S \Spec(\mathcal{O}_{S', s'})$
is \'etale, $\kappa(x) = \kappa(x')$, the scheme $X'$ is
affine, and such that $\Gamma(X', g^*\mathcal{F})$ is a free
$\mathcal{O}_{S', s'}$-module.
\end{lemma}

\begin{proof}
(The only difference with
Lemma \ref{lemma-finite-type-flat-at-point-free}
is that we do not assume $f$ is of finite presentation.)
The problem is local on $X$ and $S$. Hence we may assume $X$ and
$S$ are affine, say $X = \Spec(B)$ and $S = \Spec(A)$.
Since $B$ is a finite type $A$-algebra we can find a surjection
$A[x_1, \ldots, x_n] \to B$. In other words, we can choose a closed
immersion $i : X \to \mathbf{A}^n_S$. Set $t = i(x)$ and
$\mathcal{G} = i_*\mathcal{F}$. Note that $\mathcal{G}_t \cong \mathcal{F}_x$
are $\mathcal{O}_{S, s}$-modules. Hence $\mathcal{G}$ is flat over $S$ at $t$.
We apply
Lemma \ref{lemma-finite-type-flat-at-point-free}
to the morphism $\mathbf{A}^n_S \to S$, the point $t$, and the
sheaf $\mathcal{G}$. Thus we can find an
elementary \'etale neighbourhood $(S', s') \to (S, s)$
and a commutative diagram of pointed schemes
$$
\xymatrix{
(\mathbf{A}^n_S, t) \ar[d] & (Y, y) \ar[l]^h \ar[d] \\
(S, s) & (\Spec(\mathcal{O}_{S', s'}), s') \ar[l]
}
$$
such that $Y \to \mathbf{A}^n_{\mathcal{O}_{S', s'}}$
is \'etale, $\kappa(t) = \kappa(y)$, the scheme $Y$ is
affine, and such that $\Gamma(Y, h^*\mathcal{G})$ is a projective
$\mathcal{O}_{S', s'}$-module. Then a solution to the original
problem is given by the closed subscheme
$X' = Y \times_{\mathbf{A}^n_S} X$ of $Y$.
\end{proof}

\begin{lemma}
\label{lemma-finite-type-flat-along-fibre-free}
Let $f : X \to S$ be a morphism of schemes.
Let $\mathcal{F}$ be a quasi-coherent sheaf on $X$.
Let $s \in S$.
Assume that
\begin{enumerate}
\item $f$ is of finite presentation,
\item $\mathcal{F}$ is of finite type, and
\item $\mathcal{F}$ is flat over $S$ at all points of $X_s$.
\end{enumerate}
Then there exists an elementary \'etale neighbourhood $(S', s') \to (S, s)$
and a commutative diagram of schemes
$$
\xymatrix{
X \ar[d] & X' \ar[l]^g \ar[d] \\
S & \Spec(\mathcal{O}_{S', s'}) \ar[l]
}
$$
such that $X' \to X \times_S \Spec(\mathcal{O}_{S', s'})$
is \'etale, $X_s = g((X')_{s'})$, the scheme $X'$ is
affine of finite presentation over $\mathcal{O}_{S', s'}$,
the sheaf $g^*\mathcal{F}$ is of finite presentation over $\mathcal{O}_{X'}$,
and such that $\Gamma(X', g^*\mathcal{F})$ is a free
$\mathcal{O}_{S', s'}$-module.
\end{lemma}

\begin{proof}
For every point $x \in X_s$ we can use
Lemma \ref{lemma-finite-type-flat-at-point-free}
to find an elementary \'etale neighbourhood $(S_x , s_x) \to (S, s)$
and a commutative diagram
$$
\xymatrix{
(X, x) \ar[d] & (Y_x, y_x) \ar[l]^{g_x} \ar[d] \\
(S, s) & (\Spec(\mathcal{O}_{S_x, s_x}), s_x) \ar[l]
}
$$
such that $Y_x \to X \times_S \Spec(\mathcal{O}_{S_x, s_x})$
is \'etale, $\kappa(x) = \kappa(y_x)$, the scheme $Y_x$ is affine
of finite presentation over $\mathcal{O}_{S_x, s_x}$, the sheaf
$g_x^*\mathcal{F}$ is of finite presentation over $\mathcal{O}_{Y_x}$, and
such that $\Gamma(Y_x, g_x^*\mathcal{F})$ is a free
$\mathcal{O}_{S_x, s_x}$-module. In particular
$g_x((Y_x)_{s_x})$ is an open neighbourhood of $x$ in $X_s$.
Because $X_s$ is quasi-compact we can find a finite number of points
$x_1, \ldots, x_n \in X_s$ such that $X_s$ is the union of
the $g_{x_i}((Y_{x_i})_{s_{x_i}})$. Choose an elementary \'etale neighbourhood
$(S' , s') \to (S, s)$ which dominates each of the neighbourhoods
$(S_{x_i}, s_{x_i})$, see
More on Morphisms,
Lemma \ref{more-morphisms-lemma-elementary-etale-neighbourhoods}.
Set
$$
X' = \coprod Y_{x_i} \times_{\Spec(\mathcal{O}_{S_{x_i}, s_{x_i}})}
\Spec(\mathcal{O}_{S', s'})
$$
and endow it with the obvious morphism $g : X' \to X$.
By construction $X_s = g(X'_{s'})$ and
$$
\Gamma(X', g^*\mathcal{F})
=
\bigoplus \Gamma(Y_{x_i}, g_{x_i}^*\mathcal{F})
\otimes_{\mathcal{O}_{S_{x_i}, s_{x_i}}}
\mathcal{O}_{S', s'}.
$$
This is a free $\mathcal{O}_{S', s'}$-module as a direct sum
of base changes of free modules. Some minor details omitted.
\end{proof}

\begin{lemma}
\label{lemma-finite-type-flat-along-fibre-free-variant}
Let $f : X \to S$ be a morphism of schemes.
Let $\mathcal{F}$ be a quasi-coherent sheaf on $X$.
Let $s \in S$.
Assume that
\begin{enumerate}
\item $f$ is of finite type,
\item $\mathcal{F}$ is of finite type, and
\item $\mathcal{F}$ is flat over $S$ at all points of $X_s$.
\end{enumerate}
Then there exists an elementary \'etale neighbourhood $(S', s') \to (S, s)$
and a commutative diagram of schemes
$$
\xymatrix{
X \ar[d] & X' \ar[l]^g \ar[d] \\
S & \Spec(\mathcal{O}_{S', s'}) \ar[l]
}
$$
such that $X' \to X \times_S \Spec(\mathcal{O}_{S', s'})$
is \'etale, $X_s = g((X')_{s'})$, the scheme $X'$ is affine,
and such that $\Gamma(X', g^*\mathcal{F})$ is a free
$\mathcal{O}_{S', s'}$-module.
\end{lemma}

\begin{proof}
(The only difference with
Lemma \ref{lemma-finite-type-flat-along-fibre-free}
is that we do not assume $f$ is of finite presentation.)
For every point $x \in X_s$ we can use
Lemma \ref{lemma-finite-type-flat-at-point-free-variant}
to find an elementary \'etale neighbourhood $(S_x , s_x) \to (S, s)$
and a commutative diagram
$$
\xymatrix{
(X, x) \ar[d] & (Y_x, y_x) \ar[l]^{g_x} \ar[d] \\
(S, s) & (\Spec(\mathcal{O}_{S_x, s_x}), s_x) \ar[l]
}
$$
such that $Y_x \to X \times_S \Spec(\mathcal{O}_{S_x, s_x})$
is \'etale, $\kappa(x) = \kappa(y_x)$, the scheme $Y_x$ is affine, and
such that $\Gamma(Y_x, g_x^*\mathcal{F})$ is a free
$\mathcal{O}_{S_x, s_x}$-module. In particular
$g_x((Y_x)_{s_x})$ is an open neighbourhood of $x$ in $X_s$.
Because $X_s$ is quasi-compact we can find a finite number of points
$x_1, \ldots, x_n \in X_s$ such that $X_s$ is the union of
the $g_{x_i}((Y_{x_i})_{s_{x_i}})$. Choose an elementary \'etale neighbourhood
$(S' , s') \to (S, s)$ which dominates each of the neighbourhoods
$(S_{x_i}, s_{x_i})$, see
More on Morphisms,
Lemma \ref{more-morphisms-lemma-elementary-etale-neighbourhoods}.
Set
$$
X' = \coprod Y_{x_i} \times_{\Spec(\mathcal{O}_{S_{x_i}, s_{x_i}})}
\Spec(\mathcal{O}_{S', s'})
$$
and endow it with the obvious morphism $g : X' \to X$.
By construction $X_s = g(X'_{s'})$ and
$$
\Gamma(X', g^*\mathcal{F})
=
\bigoplus \Gamma(Y_{x_i}, g_{x_i}^*\mathcal{F})
\otimes_{\mathcal{O}_{S_{x_i}, s_{x_i}}}
\mathcal{O}_{S', s'}.
$$
This is a free $\mathcal{O}_{S', s'}$-module as a direct sum
of base changes of free modules.
\end{proof}




\section{Flat finite type modules, Part II}
\label{section-finite-type-flat-II}

\noindent
We will need the following lemma.

\begin{lemma}
\label{lemma-weak-bourbaki-pre-pre}
Let $R \to S$ be a ring map of finite presentation. Let $N$ be a
finitely presented $S$-module. Let $\mathfrak q \subset S$ be a prime ideal
lying over $\mathfrak p \subset R$. Set
$\overline{S} = S \otimes_R \kappa(\mathfrak p)$,
$\overline{\mathfrak q} = \mathfrak q \overline{S}$, and
$\overline{N} = N \otimes_R \kappa(\mathfrak p)$. Then
we can find a $g \in S$ with
$g \not \in \mathfrak q$ such that
$\overline{g} \in \mathfrak r$ for all
$\mathfrak r \in \text{Ass}_{\overline{S}}(\overline{N})$
such that $\mathfrak r \not \subset \overline{\mathfrak q}$.
\end{lemma}

\begin{proof}
Namely, if $\text{Ass}_{\overline{S}}(\overline{N}) =
\{\mathfrak r_1, \ldots, \mathfrak r_n\}$
(finiteness by Algebra, Lemma \ref{algebra-lemma-finite-ass}),
then after renumbering we may assume that
$$
\mathfrak r_1 \subset \overline{\mathfrak q},
\ldots,
\mathfrak r_r \subset \overline{\mathfrak q}, \quad
\mathfrak r_{r + 1} \not \subset \overline{\mathfrak q},
\ldots,
\mathfrak r_n \not \subset \overline{\mathfrak q}
$$
Since $\overline{\mathfrak q}$ is a prime ideal we see that the product
$\mathfrak r_{r + 1} \ldots \mathfrak r_n$ is not contained in
$\overline{\mathfrak q}$ and hence we can pick an element
$a$ of $\overline{S}$ contained in
$\mathfrak r_{r + 1}, \ldots, \mathfrak r_n$ but not in
$\overline{\mathfrak q}$.
If there exists $g \in S$ mapping to $a$, then $g$
works. In general we can find a nonzero element
$\lambda \in \kappa(\mathfrak p)$
such that $\lambda a$ is the image of a $g \in S$.
\end{proof}

\noindent
The following lemma has a slightly stronger variant
Lemma \ref{lemma-weak-bourbaki}
below.

\begin{lemma}
\label{lemma-weak-bourbaki-pre}
Let $R \to S$ be a ring map of finite presentation.
Let $N$ be a finitely presented $S$-module
which is flat as an $R$-module. Let $M$ be an $R$-module.
Let $\mathfrak q$ be a prime of $S$ lying over $\mathfrak p \subset R$.
Then
$$
\mathfrak q \in \text{WeakAss}_S(M \otimes_R N)
\Leftrightarrow
\Big(
\mathfrak p \in \text{WeakAss}_R(M)
\text{ and }
\overline{\mathfrak q} \in \text{Ass}_{\overline{S}}(\overline{N})
\Big)
$$
Here $\overline{S} = S \otimes_R \kappa(\mathfrak p)$,
$\overline{\mathfrak q} = \mathfrak q \overline{S}$, and
$\overline{N} = N \otimes_R \kappa(\mathfrak p)$.
\end{lemma}

\begin{proof}
Pick $g \in S$ as in Lemma \ref{lemma-weak-bourbaki-pre-pre}.
Apply Proposition \ref{proposition-finite-presentation-flat-at-point}
to the morphism of schemes $\Spec(S_g) \to \Spec(R)$, the quasi-coherent
module associated to $N_g$, and the points
corresponding to the primes $\mathfrak qS_g$ and $\mathfrak p$. Translating
into algebra we obtain a commutative diagram of rings
$$
\xymatrix{
S \ar[r] & S_g \ar[r] & S' \\
& R \ar[lu] \ar[u] \ar[r] & R' \ar[u]
}
\quad\quad
\xymatrix{
\mathfrak q \ar@{-}[r] \ar@{-}[rd] &
\mathfrak qS_g \ar@{-}[d] \ar@{-}[r] & \mathfrak q' \ar@{-}[d] \\
& \mathfrak p \ar@{-}[r] & \mathfrak p'
}
$$
endowed with primes as shown, the horizontal arrows are \'etale,
and $N \otimes_S S'$ is projective as an $R'$-module. Set
$N' = N \otimes_S S'$, $M' = M \otimes_R R'$,
$\overline{S}' = S' \otimes_{R'} \kappa(\mathfrak q')$,
$\overline{\mathfrak q}' = \mathfrak q' \overline{S}'$,
and
$$
\overline{N}' = N' \otimes_{R'} \kappa(\mathfrak p') =
\overline{N} \otimes_{\overline{S}} \overline{S}'
$$
By Lemma \ref{lemma-etale-weak-assassin-up-down} we have
\begin{align*}
\text{WeakAss}_{S'}(M' \otimes_{R'} N') & =
(\Spec(S') \to \Spec(S))^{-1}\text{WeakAss}_S(M \otimes_R N) \\
\text{WeakAss}_{R'}(M') & =
(\Spec(R') \to \Spec(R))^{-1}\text{WeakAss}_R(M) \\
\text{Ass}_{\overline{S}'}(\overline{N}') & =
(\Spec(\overline{S}') \to \Spec(\overline{S}))^{-1}
\text{Ass}_{\overline{S}}(\overline{N})
\end{align*}
Use Algebra, Lemma \ref{algebra-lemma-ass-weakly-ass}
for $\overline{N}$ and $\overline{N}'$. In particular we have
\begin{align*}
\mathfrak q \in \text{WeakAss}_S(M \otimes_R N)
& \Leftrightarrow
\mathfrak q' \in \text{WeakAss}_{S'}(M' \otimes_{R'} N') \\
\mathfrak p \in \text{WeakAss}_R(M)
& \Leftrightarrow
\mathfrak p' \in \text{WeakAss}_{R'}(M') \\
\overline{\mathfrak q} \in \text{Ass}_{\overline{S}}(\overline{N})
& \Leftrightarrow
\overline{\mathfrak q}' \in \text{WeakAss}_{\overline{S}'}(\overline{N}')
\end{align*}
Our careful choice of $g$ and the formula for
$\text{Ass}_{\overline{S}'}(\overline{N}')$ above shows that
\begin{equation}
\label{equation-key-observation}
\text{if }\mathfrak r' \in \text{Ass}_{\overline{S}'}(\overline{N}')
\text{ lies over }\mathfrak r \subset \overline{S}\text{ then }
\mathfrak r \subset \overline{\mathfrak q}
\end{equation}
This will be a key observation later in the proof. We will use
the characterization of weakly associated primes given in
Algebra, Lemma \ref{algebra-lemma-weakly-ass-local} without further mention.

\medskip\noindent
Suppose that
$\overline{\mathfrak q} \not \in \text{Ass}_{\overline{S}}(\overline{N})$.
Then
$\overline{\mathfrak q}' \not \in \text{Ass}_{\overline{S}'}(\overline{N}')$.
By
Algebra, Lemmas \ref{algebra-lemma-ass-zero-divisors},
\ref{algebra-lemma-finite-ass}, and
\ref{algebra-lemma-silly}
there exists an element $\overline{a}' \in \overline{\mathfrak q}'$
which is not a zerodivisor on $\overline{N}'$.
After replacing $\overline{a}'$ by $\lambda \overline{a}'$ for some nonzero
$\lambda \in \kappa(\mathfrak p)$ we can find
$a' \in \mathfrak q'$ mapping to $\overline{a}'$. By
Lemma \ref{lemma-invert-universally-injective}
the map $a' : N'_{\mathfrak p'} \to N'_{\mathfrak p'}$ is
$R'_{\mathfrak p'}$-universally injective. In particular
we see that $a' : M' \otimes_{R'} N' \to M' \otimes_{R'} N'$ is
injective after localizing at $\mathfrak p'$ and hence after
localizing at $\mathfrak q'$. Clearly this implies that
$\mathfrak q' \not \in \text{WeakAss}_{S'}(M' \otimes_{R'} N')$.
We conclude that $\mathfrak q \in \text{WeakAss}_S(M \otimes_R N)$ implies
$\overline{\mathfrak q} \in \text{Ass}_{\overline{S}}(\overline{N})$.

\medskip\noindent
Assume $\mathfrak q \in \text{WeakAss}_S(M \otimes_R N)$. We want
to show $\mathfrak p \in \text{WeakAss}_S(M)$.
Let $z \in M \otimes_R N$ be an element such that $\mathfrak q$
is minimal over $J = \text{Ann}_S(z)$.
Let $f_i \in \mathfrak p$, $i \in I$ be a set of generators of the
ideal $\mathfrak p$. Since $\mathfrak q$ lies over $\mathfrak p$, for every $i$
we can choose an $n_i \geq 1$ and $g_i \in S$, $g_i \not \in \mathfrak q$
with $g_i f_i^{n_i} \in J$, i.e., $g_i f_i^{n_i} z = 0$.
Let $z' \in (M' \otimes_{R'} N')_{\mathfrak p'}$ be the image of $z$.
Observe that $z'$ is nonzero because $z$ has nonzero image in
$(M \otimes_R N)_\mathfrak q$ and because $S_\mathfrak q \to S'_{\mathfrak q'}$
is faithfully flat. We claim that $f_i^{n_i} z' = 0$.

\medskip\noindent
Proof of the claim: Let $g'_i \in S'$ be the image of $g_i$.
By the key observation (\ref{equation-key-observation})
we find that the image $\overline{g}'_i \in \overline{S}'$
is not contained in $\mathfrak r'$ for any
$\mathfrak r' \in \text{Ass}_{\overline{S}'}(\overline{N})$.
Hence by Lemma \ref{lemma-invert-universally-injective}
we see that $g'_i : N'_{\mathfrak p'} \to N'_{\mathfrak p'}$ is
$R'_{\mathfrak p'}$-universally injective. In particular
we see that $g'_i : M' \otimes_{R'} N' \to M' \otimes_{R'} N'$ is
injective after localizating at $\mathfrak p'$. The claim
follows because $g_i f_i^{n_i} z' = 0$.

\medskip\noindent
Our claim shows that the annihilator of $z'$ in $R'_{\mathfrak p'}$
contains the elements $f_i^{n_i}$. As $R \to R'$ is \'etale we have
$\mathfrak p'R'_{\mathfrak p'} = \mathfrak pR'_{\mathfrak p'}$
by Algebra, Lemma \ref{algebra-lemma-etale-at-prime}.
Hence the annihilator of $z'$ in $R'_{\mathfrak p'}$ has radical equal to
$\mathfrak p' R_{\mathfrak p'}$ (here we use $z'$ is not zero).
On the other hand
$$
z' \in (M' \otimes_{R'} N')_{\mathfrak p'} =
M'_{\mathfrak p'} \otimes_{R'_{\mathfrak p'}} N'_{\mathfrak p'}
$$
The module $N'_{\mathfrak p'}$ is projective over the local ring
$R'_{\mathfrak p'}$ and hence free
(Algebra, Theorem \ref{algebra-theorem-projective-free-over-local-ring}).
Thus we can find a finite free direct summand $F' \subset N'_{\mathfrak p'}$
such that $z' \in M'_{\mathfrak p'} \otimes_{R'_{\mathfrak p'}} F'$.
If $F'$ has rank $n$, then we deduce that
$\mathfrak p' R'_{\mathfrak p'} \in
\text{WeakAss}_{R'_{\mathfrak p'}}({M'_{\mathfrak p'}}^{\oplus n})$.
This implies
$\mathfrak p'R'_{\mathfrak p'} \in \text{WeakAss}(M'_{\mathfrak p'})$
for example by Algebra, Lemma \ref{algebra-lemma-weakly-ass}.
Then $\mathfrak p' \in \text{WeakAss}_{R'}(M')$
which in turn gives $\mathfrak p \in \text{WeakAss}_R(M)$.
This finishes the proof of the implication
``$\Rightarrow$'' of the equivalence of the lemma.

\medskip\noindent
Assume that $\mathfrak p \in \text{WeakAss}_R(M)$ and
$\overline{\mathfrak q} \in \text{Ass}_{\overline{S}}(\overline{N})$.
We want to show that $\mathfrak q$ is weakly associated to $M \otimes_R N$.
Note that $\overline{\mathfrak q}'$ is a maximal element of
$\text{Ass}_{\overline{S}'}(\overline{N}')$.
This is a consequence of (\ref{equation-key-observation})
and the fact that there are no inclusions among the primes
of $\overline{S}'$ lying over $\overline{\mathfrak q}$
(as fibres of \'etale morphisms are discrete
Morphisms, Lemma \ref{morphisms-lemma-etale-over-field}).
Thus, after replacing $R, S, \mathfrak p, \mathfrak q, M, N$ by
$R', S', \mathfrak p', \mathfrak q', M', N'$
we may assume, in addition to the assumptions of the lemma, that
\begin{enumerate}
\item $\mathfrak p \in \text{WeakAss}_R(M)$,
\item $\overline{\mathfrak q} \in \text{Ass}_{\overline{S}}(\overline{N})$,
\item $N$ is projective as an $R$-module, and
\item $\overline{\mathfrak q}$ is maximal in
$\text{Ass}_{\overline{S}}(\overline{N})$.
\end{enumerate}
There is one more reduction, namely, we may replace
$R, S, M, N$ by their localizations at $\mathfrak p$.
This leads to one more condition, namely,
\begin{enumerate}
\item[(5)] $R$ is a local ring with maximal ideal $\mathfrak p$.
\end{enumerate}
We will finish by showing that (1) -- (5) imply
$\mathfrak q \in \text{WeakAss}(M \otimes_R N)$.

\medskip\noindent
Since $R$ is local and $\mathfrak p \in \text{WeakAss}_R(M)$
we can pick a $y \in M$ whose annihilator $I$ has radical
equal to $\mathfrak p$.
Write $\overline{\mathfrak q} = (\overline{g}_1, \ldots, \overline{g}_n)$
for some $\overline{g}_i \in \overline{S}$. Choose $g_i \in S$
mapping to $\overline{g}_i$.
Then $\mathfrak q = \mathfrak pS + g_1S + \ldots + g_nS$.
Consider the map
$$
\Psi : N/IN \longrightarrow (N/IN)^{\oplus n}, \quad
z \longmapsto (g_1z, \ldots, g_nz).
$$
This is a homomorphism of projective $R/I$-modules.
The local ring $R/I$ is auto-associated
(More on Algebra, Definition \ref{more-algebra-definition-auto-ass})
as $\mathfrak p/I$ is locally nilpotent.
The map $\Psi \otimes \kappa(\mathfrak p)$ is not injective, because
$\overline{\mathfrak q} \in \text{Ass}_{\overline{S}}(\overline{N})$.
Hence More on Algebra, Lemma \ref{more-algebra-lemma-P-fPD-zero}
implies $\Psi$ is not injective. Pick $z \in N/IN$
nonzero in the kernel of $\Psi$. The annihilator $J = \text{Ann}_S(z)$
contains $IS$ and $g_i$ by construction. Thus
$\sqrt{J} \subset S$ contains $\mathfrak q$.
Let $\mathfrak s \subset S$ be a prime minimal over $J$.
Then $\mathfrak q \subset \mathfrak s$,
$\mathfrak s$ lies over $\mathfrak p$, and
$\mathfrak s \in \text{WeakAss}_S(N/IN)$.
The last fact by definition of weakly associated primes.
Apply the ``$\Rightarrow$'' part of the lemma (which we've already proven)
to the ring map $R \to S$ and the modules $R/I$ and $N$
to conclude that
$\overline{\mathfrak s} \in \text{Ass}_{\overline{S}}(\overline{N})$.
Since $\overline{\mathfrak q} \subset \overline{\mathfrak s}$
the maximality of $\overline{\mathfrak q}$, see condition (4) above,
implies that $\overline{\mathfrak q} = \overline{\mathfrak s}$.
This shows that $\mathfrak q = \mathfrak s$ and we conlude
what we want.
\end{proof}

\begin{lemma}
\label{lemma-bourbaki-finite-type-general-base-at-point}
Let $S$ be a scheme.
Let $f : X \to S$ be locally of finite type.
Let $x \in X$ with image $s \in S$.
Let $\mathcal{F}$ be a finite type quasi-coherent sheaf on $X$.
Let $\mathcal{G}$ be a quasi-coherent sheaf on $S$.
If $\mathcal{F}$ is flat at $x$ over $S$, then
$$
x \in \text{WeakAss}_X(\mathcal{F} \otimes_{\mathcal{O}_X} f^*\mathcal{G})
\Leftrightarrow
s \in \text{WeakAss}_S(\mathcal{G})
\text{ and }
x \in \text{Ass}_{X_s}(\mathcal{F}_s).
$$
\end{lemma}

\begin{proof}
In this paragraph we reduce to $f$ being of finite presentation.
The question is local on $X$ and $S$, hence we may assume $X$ and $S$
are affine. Write $X = \Spec(B)$, $S = \Spec(A)$ and write
$B = A[x_1, \ldots, x_n]/I$. In other words we obtain a closed immersion
$i : X \to \mathbf{A}^n_S$ over $S$. Denote $t = i(x) \in \mathbf{A}^n_S$.
Note that $i_*\mathcal{F}$ is a finite type quasi-coherent sheaf on
$\mathbf{A}^n_S$ which is flat at $t$ over $S$ and note that
$$
i_*(\mathcal{F} \otimes_{\mathcal{O}_X} f^*\mathcal{G}) =
i_*\mathcal{F} \otimes_{\mathcal{O}_{\mathbf{A}^n_S}} p^*\mathcal{G}
$$
where $p : \mathbf{A}^n_S \to S$ is the projection. Note that
$t$ is a weakly associated point of
$i_*(\mathcal{F} \otimes_{\mathcal{O}_X} f^*\mathcal{G})$
if and only if $x$ is a weakly associated point of
$\mathcal{F} \otimes_{\mathcal{O}_X} f^*\mathcal{G}$, see
Divisors, Lemma \ref{divisors-lemma-weakly-associated-finite}.
Similarly $x \in \text{Ass}_{X_s}(\mathcal{F}_s)$ if and only
if $t \in \text{Ass}_{\mathbf{A}^n_s}((i_*\mathcal{F})_s)$ (see
Algebra, Lemma \ref{algebra-lemma-ass-quotient-ring}).
Hence it suffices to prove the lemma in case $X = \mathbf{A}^n_S$.
Thus we may assume that $X \to S$ is of finite presentation.

\medskip\noindent
In this paragraph we reduce to $\mathcal{F}$ being of finite presentation
and flat over $S$.
Choose an elementary \'etale neighbourhood $e : (S', s') \to (S, s)$
and an open $V \subset X \times_S \Spec(\mathcal{O}_{S', s'})$
as in Proposition \ref{proposition-finite-type-flat-at-point}.
Let $x' \in X' = X \times_S S'$ be the unique point mapping to $x$
and $s'$. Then it suffices to prove the statement for
$X' \to S'$, $x'$, $s'$, $(X' \to X)^*\mathcal{F}$, and $e^*\mathcal{G}$, see
Lemma \ref{lemma-etale-weak-assassin-up-down}.
Let $v \in V$ the unique point mapping to $x'$
and let $s' \in \Spec(\mathcal{O}_{S', s'})$ be the closed point.
Then $\mathcal{O}_{V, v} = \mathcal{O}_{X', x'}$
and $\mathcal{O}_{\Spec(\mathcal{O}_{S', s'}), s'} =
\mathcal{O}_{S', s'}$ and similarly for the stalks of pullbacks of
$\mathcal{F}$ and $\mathcal{G}$.
Also $V_{s'} \subset X'_{s'}$ is an open subscheme.
Since the condition of being a weakly associated point
depend only on the stalk of the sheaf, we may
replace
$X' \to S'$, $x'$, $s'$, $(X' \to X)^*\mathcal{F}$, and $e^*\mathcal{G}$
by
$V \to \Spec(\mathcal{O}_{S', s'})$, $v$, $s'$, $(V \to X)^*\mathcal{F}$,
and $(\Spec(\mathcal{O}_{S', s'}) \to S)^*\mathcal{G}$.
Thus we may assume that $f$ is of finite presentation and
$\mathcal{F}$ of finite presentation and flat over $S$.

\medskip\noindent
Assume $f$ is of finite presentation and
$\mathcal{F}$ of finite presentation and flat over $S$.
After shrinking $X$ and $S$ to affine neighbourhoods
of $x$ and $s$, this case is handled by
Lemma \ref{lemma-weak-bourbaki-pre}.
\end{proof}

\begin{lemma}
\label{lemma-weak-bourbaki}
Let $R \to S$ be a ring map which is essentially of finite type.
Let $N$ be a localization of a finite $S$-module flat over $R$.
Let $M$ be an $R$-module. Then
$$
\text{WeakAss}_S(M \otimes_R N)
=
\bigcup\nolimits_{\mathfrak p \in \text{WeakAss}_R(M)}
\text{Ass}_{S \otimes_R \kappa(\mathfrak p)}(N \otimes_R \kappa(\mathfrak p))
$$
\end{lemma}

\begin{proof}
This lemma is a translation of
Lemma \ref{lemma-bourbaki-finite-type-general-base-at-point}
into algebra. Details of translation omitted.
\end{proof}

\begin{lemma}
\label{lemma-bourbaki-finite-type-general-base}
Let $f : X \to S$ be a morphism which is locally of finite type.
Let $\mathcal{F}$ be a finite type quasi-coherent sheaf on $X$
which is flat over $S$. Let $\mathcal{G}$ be a quasi-coherent sheaf on $S$.
Then we have
$$
\text{WeakAss}_X(\mathcal{F} \otimes_{\mathcal{O}_X} f^*\mathcal{G}) =
\bigcup\nolimits_{s \in \text{WeakAss}_S(\mathcal{G})}
\text{Ass}_{X_s}(\mathcal{F}_s)
$$
\end{lemma}

\begin{proof}
Immediate consequence of
Lemma \ref{lemma-bourbaki-finite-type-general-base-at-point}.
\end{proof}

\begin{theorem}
\label{theorem-finite-type-flat}
\begin{slogan}
The flat locus is open (non-Noetherian version).
\end{slogan}
Let $f : X \to S$ be a morphism of schemes.
Let $\mathcal{F}$ be a quasi-coherent $\mathcal{O}_X$-module.
Assume
\begin{enumerate}
\item $X \to S$ is locally of finite presentation,
\item $\mathcal{F}$ is an $\mathcal{O}_X$-module of finite type, and
\item the set of weakly associated points of $S$ is locally finite in $S$.
\end{enumerate}
Then $U = \{x \in X \mid \mathcal{F}\text{ flat at }x\text{ over }S\}$
is open in $X$ and $\mathcal{F}|_U$ is an $\mathcal{O}_U$-module
of finite presentation and flat over $S$.
\end{theorem}

\begin{proof}
Let $x \in X$ be such that $\mathcal{F}$ is flat at $x$ over $S$.
We have to find an open neighbourhood of $x$ such that $\mathcal{F}$ restricts
to a $S$-flat finitely presented module on this neighbourhood.
The problem is local on $X$ and $S$, hence we may assume that $X$ and $S$
are affine. As $\mathcal{F}_x$ is a finitely presented
$\mathcal{O}_{X, x}$-module by
Lemma \ref{lemma-finite-type-flat-at-point-local}
we conclude from
Algebra, Lemma \ref{algebra-lemma-construct-fp-module-from-stalk}
there exists a finitely presented $\mathcal{O}_X$-module $\mathcal{F}'$
and a map $\varphi : \mathcal{F}' \to \mathcal{F}$ which induces
an isomorphism $\varphi_x : \mathcal{F}'_x \to \mathcal{F}_x$. In particular
we see that $\mathcal{F}'$ is flat over $S$ at $x$, hence by openness
of flatness
More on Morphisms, Theorem \ref{more-morphisms-theorem-openness-flatness}
we see that after shrinking $X$ we may assume that
$\mathcal{F}'$ is flat over $S$. As $\mathcal{F}$ is of finite type
after shrinking $X$ we may assume that $\varphi$ is surjective, see
Modules, Lemma \ref{modules-lemma-finite-type-surjective-on-stalk}
or alternatively use Nakayama's lemma
(Algebra, Lemma \ref{algebra-lemma-NAK}).
By
Lemma \ref{lemma-bourbaki-finite-type-general-base}
we have
$$
\text{WeakAss}_X(\mathcal{F}') \subset
\bigcup\nolimits_{s \in \text{WeakAss}(S)} \text{Ass}_{X_s}(\mathcal{F}'_s)
$$
As $\text{WeakAss}(S)$ is finite by assumption and since
$\text{Ass}_{X_s}(\mathcal{F}'_s)$ is finite by
Divisors, Lemma \ref{divisors-lemma-finite-ass}
we conclude that $\text{WeakAss}_X(\mathcal{F}')$ is finite. Using
Algebra, Lemma \ref{algebra-lemma-silly}
we may, after shrinking $X$ once more, assume that
$\text{WeakAss}_X(\mathcal{F}')$ is contained in the generalization
of $x$. Now consider $\mathcal{K} = \Ker(\varphi)$. We have
$\text{WeakAss}_X(\mathcal{K}) \subset \text{WeakAss}_X(\mathcal{F}')$
(by
Divisors, Lemma \ref{divisors-lemma-ses-weakly-ass})
but on the other hand, $\varphi_x$ is an isomorphism, also $\varphi_{x'}$
is an isomorphism for all $x' \leadsto x$. We conclude that
$\text{WeakAss}_X(\mathcal{K}) = \emptyset$ whence
$\mathcal{K} = 0$ by
Divisors, Lemma \ref{divisors-lemma-weakly-ass-zero}.
\end{proof}

\begin{lemma}
\label{lemma-finite-type-flat-algebra}
Let $R \to S$ be a ring map of finite presentation.
Let $M$ be a finite $S$-module. Assume $\text{WeakAss}_S(S)$ is finite.
Then
$$
U = \{\mathfrak q \subset S \mid M_{\mathfrak q}\text{ flat over }R\}
$$
is open in $\Spec(S)$ and for every $g \in S$ such that
$D(g) \subset U$ the localization $M_g$ is a finitely presented
$S_g$-module flat over $R$.
\end{lemma}

\begin{proof}
Follows immediately from
Theorem \ref{theorem-finite-type-flat}.
\end{proof}

\begin{lemma}
\label{lemma-finite-type-flat-X}
Let $f : X \to S$ be a morphism of schemes which is locally of finite
type. Assume the set of weakly associated points of $S$ is locally finite
in $S$. Then the set of points $x \in X$ where $f$ is flat is an open
subscheme $U \subset X$ and $U \to S$ is flat and locally of finite
presentation.
\end{lemma}

\begin{proof}
The problem is local on $X$ and $S$, hence we may assume that
$X$ and $S$ are affine. Then $X \to S$ corresponds to a finite type
ring map $A \to B$. Choose a surjection $A[x_1, \ldots, x_n] \to B$
and consider $B$ as an $A[x_1, \ldots, x_n]$-module. An application of
Lemma \ref{lemma-finite-type-flat-algebra}
finishes the proof.
\end{proof}

\begin{lemma}
\label{lemma-finite-type-flat-over-integral}
Let $f : X \to S$ be a morphism of schemes which is
locally of finite type and flat. If $S$ is integral, then $f$
is locally of finite presentation.
\end{lemma}

\begin{proof}
Special case of
Lemma \ref{lemma-finite-type-flat-X}.
\end{proof}

\begin{proposition}
\label{proposition-flat-finite-type-finite-presentation-domain}
Let $R$ be a domain. Let $R \to S$ be a ring map of finite type.
Let $M$ be a finite $S$-module.
\begin{enumerate}
\item If $S$ is flat over $R$, then $S$ is a finitely presented $R$-algebra.
\item If $M$ is flat as an $R$-module, then $M$ is finitely presented
as an $S$-module.
\end{enumerate}
\end{proposition}

\begin{proof}
Part (1) is a special case of
Lemma \ref{lemma-finite-type-flat-over-integral}.
For Part (2) choose a surjection $R[x_1, \ldots, x_n] \to S$.
By Lemma \ref{lemma-finite-type-flat-algebra} we find that $M$
is finitely presented as an $R[x_1, \ldots, x_n]$-module.
We conclude by Algebra, Lemma
\ref{algebra-lemma-finitely-presented-over-subring}.
\end{proof}

\begin{lemma}[Finite type version of Theorem \ref{theorem-finite-type-flat}]
\label{lemma-finite-type-flat}
Let $f : X \to S$ be a morphism of schemes.
Let $\mathcal{F}$ be a quasi-coherent $\mathcal{O}_X$-module.
Assume
\begin{enumerate}
\item $X \to S$ is locally of finite type,
\item $\mathcal{F}$ is an $\mathcal{O}_X$-module of finite type, and
\item the set of weakly associated points of $S$ is locally finite in $S$.
\end{enumerate}
Then $U = \{x \in X \mid \mathcal{F}\text{ flat at }x\text{ over }S\}$
is open in $X$ and $\mathcal{F}|_U$ is flat over $S$ and locally
finitely presented relative to $S$ (see
More on Morphisms, Definition
\ref{more-morphisms-definition-relatively-finitely-presented-sheaf}).
\end{lemma}

\begin{proof}
The question is local on $X$ and $S$. Thus we may assume $X$ and $S$ are affine.
Then we may choose a closed immersion $i : X \to \mathbf{A}^n_S$.
We apply Theorem \ref{theorem-finite-type-flat} to $X' = \mathbf{A}^n_S \to S$
and the quasi-coherent module $\mathcal{F}' = i_*\mathcal{F}$ of finite type
and we find that
$$
U' = \{x' \in X' \mid \mathcal{F}'\text{ flat at }x'\text{ over }S\}
$$
is open in $X'$ and that $\mathcal{F}'|_{U'}$ is of finite presentation.
Since $\mathcal{F}'$ restricts to zero on $X' \setminus i(X)$ and
since $\mathcal{F}'_{i(x)} \cong \mathcal{F}_x$ for all $x \in X$ we see that
$$
U' = i(U) \amalg (X' \setminus i(X))
$$
Hence $U = i^{-1}(U')$ is open. Moreover, it is clear that
$\mathcal{F}'|_{U'} = (i|_U)_*(\mathcal{F}|_U)$.
Hence we conclude that $\mathcal{F}|_U$ is finitely presented
relative to $S$ by More on Morphisms, Lemmas
\ref{more-morphisms-lemma-relative-finite-presentation} and
\ref{more-morphisms-lemma-finite-morphism-relative-finite-presentation}.
\end{proof}

\begin{lemma}
\label{lemma-finite-type-flat-algebra-bis}
Let $R \to S$ be a ring map of finite type.
Let $M$ be a finite $S$-module.
Assume $\text{WeakAss}_R(R)$ is finite.
Then
$$
U = \{\mathfrak q \subset S \mid M_{\mathfrak q}\text{ flat over }R\}
$$
is open in $\Spec(S)$ and for every $g \in S$ such that
$D(g) \subset U$ the localization $M_g$ is flat over $R$ and
an $S_g$-module finitely presented relative to $R$ (see
More on Algebra, Definition
\ref{more-algebra-definition-relatively-finitely-presented}).
\end{lemma}

\begin{proof}
This is Lemma \ref{lemma-finite-type-flat} translated into algebra.
\end{proof}








\section{Examples of relatively pure modules}
\label{section-examples-pure-modules}

\noindent
In the short section we discuss some examples of results that will serve
as motivation for the notion of a {\it relatively pure module} and the
concept of an {\it impurity} which we will introduce later. Each of the
examples is stated as a lemma. Note the similarity with the condition on
associated primes to the conditions appearing in
Lemmas \ref{lemma-base-change-universally-flat},
\ref{lemma-universally-injective-to-completion},
\ref{lemma-universally-injective-to-completion-flat}, and
\ref{lemma-flat-pure-over-complete-projective}.
See also
Algebra, Lemma \ref{algebra-lemma-compare-relative-assassins}
for a discussion.

\begin{lemma}
\label{lemma-explain-why-pure}
Let $R$ be a local ring with maximal ideal $\mathfrak m$.
Let $R \to S$ be a ring map. Let $N$ be an $S$-module.
Assume
\begin{enumerate}
\item $N$ is projective as an $R$-module, and
\item $S/\mathfrak mS$ is Noetherian and $N/\mathfrak mN$ is a finite
$S/\mathfrak mS$-module.
\end{enumerate}
Then for any prime $\mathfrak q \subset S$ which is an associated prime of
$N \otimes_R \kappa(\mathfrak p)$ where $\mathfrak p = R \cap \mathfrak q$
we have $\mathfrak q + \mathfrak m S \not = S$.
\end{lemma}

\begin{proof}
Note that the hypotheses of
Lemmas \ref{lemma-homothety-spectrum} and
\ref{lemma-invert-universally-injective}
are satisfied. We will use the conclusions of these lemmas without further
mention. Let $\Sigma \subset S$ be the multiplicative set of elements
which are not zerodivisors on $N/\mathfrak mN$. The map
$N \to \Sigma^{-1}N$ is $R$-universally injective. Hence we see that
any $\mathfrak q \subset S$ which is an associated prime of
$N \otimes_R \kappa(\mathfrak p)$ is also an associated prime of
$\Sigma^{-1}N \otimes_R \kappa(\mathfrak p)$. Clearly this implies that
$\mathfrak q$ corresponds to a prime of $\Sigma^{-1}S$.
Thus $\mathfrak q \subset \mathfrak q'$ where $\mathfrak q'$
corresponds to an associated prime of $N/\mathfrak mN$ and we win.
\end{proof}

\noindent
The following lemma gives another (slightly silly) example of this phenomenon.

\begin{lemma}
\label{lemma-explain-why-pure-complete}
Let $R$ be a ring. Let $I \subset R$ be an ideal.
Let $R \to S$ be a ring map. Let $N$ be an $S$-module.
If $N$ is $I$-adically complete, then for any $R$-module $M$ and
for any prime $\mathfrak q \subset S$ which is an associated prime of
$N \otimes_R M$ we have $\mathfrak q + I S \not = S$.
\end{lemma}

\begin{proof}
Let $S^\wedge$ denote the $I$-adic completion of $S$.
Note that $N$ is an $S^\wedge$-module, hence also
$N \otimes_R M$ is an $S^\wedge$-module.
Let $z \in N \otimes_R M$ be an element such that
$\mathfrak q = \text{Ann}_S(z)$. Since $z \not = 0$ we see
that $\text{Ann}_{S^\wedge}(z) \not = S^\wedge$. Hence
$\mathfrak q S^\wedge \not = S^\wedge$. Hence there exists a
maximal ideal $\mathfrak m \subset S^\wedge$ with
$\mathfrak q S^\wedge \subset \mathfrak m$. Since
$IS^\wedge \subset \mathfrak m$ by
Algebra, Lemma \ref{algebra-lemma-radical-completion}
we win.
\end{proof}

\noindent
Note that the following lemma gives an alternative proof of
Lemma \ref{lemma-explain-why-pure}
as a projective module over a local ring is free, see
Algebra, Theorem \ref{algebra-theorem-projective-free-over-local-ring}.

\begin{lemma}
\label{lemma-explain-why-pure-direct-sum-finite-modules}
Let $R$ be a local ring with maximal ideal $\mathfrak m$.
Let $R \to S$ be a ring map. Let $N$ be an $S$-module.
Assume $N$ is isomorphic as an $R$-module to a direct
sum of finite $R$-modules. Then for any $R$-module $M$ and
for any prime $\mathfrak q \subset S$ which is an associated prime of
$N \otimes_R M$ we have $\mathfrak q + \mathfrak m S \not = S$.
\end{lemma}

\begin{proof}
Write $N = \bigoplus_{i \in I} M_i$ with each $M_i$ a finite $R$-module.
Let $M$ be an $R$-module and let $\mathfrak q \subset S$ be an associated
prime of $N \otimes_R M$ such that $\mathfrak q + \mathfrak m S = S$. Let
$z \in N \otimes_R M$ be an element with $\mathfrak q = \text{Ann}_S(z)$.
After modifying the direct sum decomposition a little bit we may assume that
$z \in M_1 \otimes_R M$ for some element $1 \in I$. Write
$1 = f + \sum x_j g_j$ for some $f \in \mathfrak q$, $x_j \in \mathfrak m$,
and $g_j \in S$. For any $g \in S$ denote $g'$ the $R$-linear map
$$
M_1 \to N \xrightarrow{g} N \to M_1
$$
where the first arrow is the inclusion map, the second arrow is multiplication
by $g$ and the third arrow is the projection map. Because each $x_j \in R$
we obtain the equality
$$
f' + \sum x_j g'_j = \text{id}_{M_1} \in \text{End}_R(M_1)
$$
By Nakayama's lemma
(Algebra, Lemma \ref{algebra-lemma-NAK})
we see that $f'$ is surjective, hence by
Algebra, Lemma \ref{algebra-lemma-fun}
we see that $f'$ is an isomorphism. In particular the map
$$
M_1 \otimes_R M \to N \otimes_R M \xrightarrow{f} N \otimes_R M
\to M_1 \otimes_R M
$$
is an isomorphism. This contradicts the assumption that $fz = 0$.
\end{proof}

\begin{lemma}
\label{lemma-explain-why-pure-ML}
Let $R$ be a henselian local ring with maximal ideal $\mathfrak m$.
Let $R \to S$ be a ring map. Let $N$ be an $S$-module.
Assume $N$ is countably generated and Mittag-Leffler as an $R$-module.
Then for any $R$-module $M$ and for any prime $\mathfrak q \subset S$
which is an associated prime of $N \otimes_R M$ we have
$\mathfrak q + \mathfrak m S \not = S$.
\end{lemma}

\begin{proof}
This lemma reduces to
Lemma \ref{lemma-explain-why-pure-direct-sum-finite-modules}
by
Algebra, Lemma \ref{algebra-lemma-split-ML-henselian}.
\end{proof}

\noindent
Suppose $f : X \to S$ is a morphism of schemes and
$\mathcal{F}$ is a quasi-coherent module on $X$.
Let $\xi \in \text{Ass}_{X/S}(\mathcal{F})$ and let $Z = \overline{\{\xi\}}$.
Picture
$$
\xymatrix{
\xi \ar@{|->}[d] & Z \ar[r] \ar[rd] & X \ar[d]^f \\
f(\xi) & & S
}
$$
Note that $f(Z) \subset \overline{\{f(\xi)\}}$ and that $f(Z)$ is closed
if and only if equality holds, i.e., $f(Z) = \overline{\{f(\xi)\}}$.
It follows from
Lemma \ref{lemma-explain-why-pure}
that if $S$, $X$ are affine, the fibres $X_s$ are Noetherian,
$\mathcal{F}$ is of finite type, and $\Gamma(X, \mathcal{F})$
is a projective $\Gamma(S, \mathcal{O}_S)$-module, then
$f(Z) = \overline{\{f(\xi)\}}$ is a closed subset.
Slightly different analogous statements holds for the cases described in
Lemmas \ref{lemma-explain-why-pure-complete},
\ref{lemma-explain-why-pure-direct-sum-finite-modules}, and
\ref{lemma-explain-why-pure-ML}.




\section{Impurities}
\label{section-impure}

\noindent
We want to formalize the phenomenon of which we gave examples in
Section \ref{section-examples-pure-modules}
in terms of specializations of points of $\text{Ass}_{X/S}(\mathcal{F})$.
We also want to work locally around a point $s \in S$. In order to do so we
make the following definitions.

\begin{situation}
\label{situation-pre-pure}
Here $S$, $X$ are schemes and $f : X \to S$ is a finite type morphism.
Also, $\mathcal{F}$ is a finite type quasi-coherent $\mathcal{O}_X$-module.
Finally $s$ is a point of $S$.
\end{situation}

\noindent
In this situation consider a morphism $g : T \to S$, a point $t \in T$
with $g(t) = s$, a specialization $t' \leadsto t$, and a point
$\xi \in X_T$ in the base change of $X$ lying over $t'$. Picture
\begin{equation}
\label{equation-impurity}
\vcenter{
\xymatrix{
\xi \ar@{|->}[d] & \\
t' \ar@{~>}[r] & t \ar@{|->}[r] & s
}
}
\quad\quad
\vcenter{
\xymatrix{
X_T \ar[d] \ar[r] & X \ar[d] \\
T \ar[r]^g & S
}
}
\end{equation}
Moreover, denote $\mathcal{F}_T$ the pullback of $\mathcal{F}$ to $X_T$.

\begin{definition}
\label{definition-impurity}
In
Situation \ref{situation-pre-pure}
we say a diagram (\ref{equation-impurity}) defines an
{\it impurity of $\mathcal{F}$ above $s$}
if $\xi \in \text{Ass}_{X_T/T}(\mathcal{F}_T)$ and
$\overline{\{\xi\}} \cap X_t = \emptyset$. We will indicate
this by saying ``let $(g : T \to S, t' \leadsto t, \xi)$ be
an impurity of $\mathcal{F}$ above $s$''.
\end{definition}

\begin{lemma}
\label{lemma-impure-finite-presentation}
In Situation \ref{situation-pre-pure}.
If there exists an impurity of $\mathcal{F}$ above $s$, then
there exists an impurity $(g : T \to S, t' \leadsto t, \xi)$
of $\mathcal{F}$ above $s$ such that $g$ is locally of finite
presentation and $t$ a closed point of the fibre of $g$ above $s$.
\end{lemma}

\begin{proof}
Let $(g : T \to S, t' \leadsto t, \xi)$ be any impurity of
$\mathcal{F}$ above $s$. We apply
Limits, Lemma \ref{limits-lemma-separate}
to $t \in T$ and $Z = \overline{\{\xi\}}$ to obtain an open neighbourhood
$V \subset T$ of $t$, a commutative diagram
$$
\xymatrix{
V \ar[d] \ar[r]_a & T' \ar[d]^b \\
T \ar[r]^g & S,
}
$$
and a closed subscheme $Z' \subset X_{T'}$ such that
\begin{enumerate}
\item the morphism $b : T' \to S$ is locally of finite presentation,
\item we have $Z' \cap X_{a(t)} = \emptyset$, and
\item $Z \cap X_V$ maps into $Z'$ via the morphism $X_V \to X_{T'}$.
\end{enumerate}
As $t'$ specializes to $t$ we may replace $T$ by the open neighbourhood
$V$ of $t$. Thus we have a commutative diagram
$$
\xymatrix{
X_T \ar[d] \ar[r] &
X_{T'} \ar[d] \ar[r] &
X \ar[d] \\
T \ar[r]^a & T' \ar[r]^b & S
}
$$
where $b \circ a = g$. Let $\xi' \in X_{T'}$ denote the
image of $\xi$. By
Divisors, Lemma \ref{divisors-lemma-base-change-relative-assassin}
we see that $\xi' \in \text{Ass}_{X_{T'}/T'}(\mathcal{F}_{T'})$.
Moreover, by construction the closure of $\overline{\{\xi'\}}$
is contained in the closed subset $Z'$ which avoids the fibre
$X_{a(t)}$. In this way we see that $(T' \to S, a(t') \leadsto a(t), \xi')$
is an impurity of $\mathcal{F}$ above $s$.

\medskip\noindent
Thus we may assume that $g : T \to S$ is locally of finite presentation.
Let $Z = \overline{\{\xi\}}$. By assumption $Z_t = \emptyset$. By
More on Morphisms, Lemma \ref{more-morphisms-lemma-empty-generic-fibre}
this means that $Z_{t''} = \emptyset$ for $t''$ in an open subset
of $\overline{\{t\}}$. Since the fibre of
$T \to S$ over $s$ is a Jacobson scheme, see
Morphisms, Lemma \ref{morphisms-lemma-ubiquity-Jacobson-schemes}
we find that there exist a closed point $t'' \in \overline{\{t\}}$ such that
$Z_{t''} = \emptyset$. Then $(g : T \to S, t' \leadsto t'', \xi)$ is the
desired impurity.
\end{proof}

\begin{lemma}
\label{lemma-impure-limit}
In Situation \ref{situation-pre-pure}.
Let $(g : T \to S, t' \leadsto t, \xi)$ be an impurity of
$\mathcal{F}$ above $s$. Assume $T = \lim_{i \in I} T_i$
is a directed limit of affine schemes over $S$. Then for
some $i$ the triple $(T_i \to S, t'_i \leadsto t_i, \xi_i)$
is an impurity of $\mathcal{F}$ above $s$.
\end{lemma}

\begin{proof}
The notation in the statement means this: Let $p_i : T \to T_i$
be the projection morphisms, let $t_i = p_i(t)$ and $t'_i = p_i(t')$.
Finally $\xi_i \in X_{T_i}$ is the image of $\xi$. By
Divisors, Lemma \ref{divisors-lemma-base-change-relative-assassin}
it is true that $\xi_i$ is a point of the relative
assassin of $\mathcal{F}_{T_i}$ over $T_i$. Thus the only point is to
show that $\overline{\{\xi_i\}} \cap X_{t_i} = \emptyset$ for some $i$.

\medskip\noindent
First proof. Let $Z_i = \overline{\{\xi_i\}} \subset X_{T_i}$
and $Z = \overline{\{\xi\}} \subset X_T$
endowed with the reduced induced scheme structure.
Then $Z = \lim Z_i$ by
Limits, Lemma \ref{limits-lemma-inverse-limit-irreducibles}.
Choose a field $k$ and a morphism $\Spec(k) \to T$ whose image is $t$.
Then
$$
\emptyset =
Z \times_T \Spec(k) = (\lim Z_i) \times_{(\lim T_i)} \Spec(k)
= \lim Z_i \times_{T_i} \Spec(k)
$$
because limits commute with fibred products (limits commute with limits).
Each $Z_i \times_{T_i} \Spec(k)$ is quasi-compact because $X_{T_i} \to T_i$
is of finite type and hence $Z_i \to T_i$ is of finite type.
Hence $Z_i \times_{T_i} \Spec(k)$ is empty for some $i$ by
Limits, Lemma \ref{limits-lemma-limit-nonempty}.
Since the image of the composition $\Spec(k) \to T \to T_i$ is $t_i$
we obtain what we want.

\medskip\noindent
Second proof. Set $Z = \overline{\{\xi\}}$. Apply
Limits, Lemma \ref{limits-lemma-separate}
to this situation to obtain an open neighbourhood
$V \subset T$ of $t$, a commutative diagram
$$
\xymatrix{
V \ar[d] \ar[r]_a & T' \ar[d]^b \\
T \ar[r]^g & S,
}
$$
and a closed subscheme $Z' \subset X_{T'}$ such that
\begin{enumerate}
\item the morphism $b : T' \to S$ is locally of finite presentation,
\item we have $Z' \cap X_{a(t)} = \emptyset$, and
\item $Z \cap X_V$ maps into $Z'$ via the morphism $X_V \to X_{T'}$.
\end{enumerate}
We may assume $V$ is an affine open of $T$, hence by
Limits, Lemmas \ref{limits-lemma-descend-opens} and
\ref{limits-lemma-limit-affine}
we can find an $i$ and an affine open $V_i \subset T_i$ with
$V = f_i^{-1}(V_i)$. By
Limits,
Proposition \ref{limits-proposition-characterize-locally-finite-presentation}
after possibly increasing $i$ a bit we can find a morphism
$a_i : V_i \to T'$ such that $a = a_i \circ f_i|_V$.
The induced morphism $X_{V_i} \to X_{T'}$ maps $\xi_i$ into
$Z'$. As $Z' \cap X_{a(t)} = \emptyset$ we conclude that
$(T_i \to S, t'_i \leadsto t_i, \xi_i)$ is an impurity of
$\mathcal{F}$ above $s$.
\end{proof}

\begin{lemma}
\label{lemma-quasi-finite-impurity-elementary}
In Situation \ref{situation-pre-pure}.
If there exists an impurity $(g : T \to S, t' \leadsto t, \xi)$
of $\mathcal{F}$ above $s$ with $g$ quasi-finite at $t$, then there
exists an impurity $(g : T \to S, t' \leadsto t, \xi)$ such that
$(T, t) \to (S, s)$ is an elementary \'etale neighbourhood.
\end{lemma}

\begin{proof}
Let $(g : T \to S, t' \leadsto t, \xi)$ be an impurity of
$\mathcal{F}$ above $s$ such that $g$ is quasi-finite at $t$.
After shrinking $T$ we may assume that $g$ is locally of finite type.
Apply
More on Morphisms,
Lemma \ref{more-morphisms-lemma-etale-makes-quasi-finite-finite-at-point}
to $T \to S$ and $t \mapsto s$. This gives us a diagram
$$
\xymatrix{
T \ar[d] & T \times_S U \ar[l] \ar[d] & V \ar[l] \ar[ld] \\
S & U \ar[l]
}
$$
where $(U, u) \to (S, s)$ is an elementary \'etale neighbourhood
and $V \subset T \times_S U$ is an open neighbourhood of $v = (t, u)$
such that $V \to U$ is finite and such that $v$ is the unique point of $V$
lying over $u$. Since the morphism $V \to T$ is \'etale
hence flat we see that there exists a specialization $v' \leadsto v$ such
that $v' \mapsto t'$. Note that $\kappa(t') \subset \kappa(v')$
is finite separable. Pick any point $\zeta \in X_{v'}$ mapping to
$\xi \in X_{t'}$. By
Divisors, Lemma \ref{divisors-lemma-base-change-relative-assassin}
we see that $\zeta \in \text{Ass}_{X_V/V}(\mathcal{F}_V)$.
Moreover, the closure $\overline{\{\zeta\}}$ does not meet
the fibre $X_v$ as by assumption the closure $\overline{\{\xi\}}$
does not meet $X_t$. In other words $(V \to S, v' \leadsto v, \zeta)$
is an impurity of $\mathcal{F}$ above $S$.

\medskip\noindent
Next, let $u' \in U'$ be the image of $v'$ and let
$\theta \in X_U$ be the image of $\zeta$.
Then $\theta \mapsto u'$ and $u' \leadsto u$.
By
Divisors, Lemma \ref{divisors-lemma-base-change-relative-assassin}
we see that $\theta \in \text{Ass}_{X_U/U}(\mathcal{F})$.
Moreover, as $\pi : X_V \to X_U$ is finite we see that
$\pi\big(\overline{\{\zeta\}}\big) = \overline{\{\pi(\zeta)\}}$. Since
$v$ is the unique point of $V$ lying over $u$ we see that
$X_u \cap \overline{\{\pi(\zeta)\}} = \emptyset$ because
$X_v \cap \overline{\{\zeta\}} = \emptyset$. In this way we conclude that
$(U \to S, u' \leadsto u, \theta)$ is an impurity of
$\mathcal{F}$ above $s$ and we win.
\end{proof}

\begin{lemma}
\label{lemma-Noetherian-impurity-quasi-finite}
In Situation \ref{situation-pre-pure}.
Assume that $S$ is locally Noetherian.
If there exists an impurity of $\mathcal{F}$ above $s$, then
there exists an impurity $(g : T \to S, t' \leadsto t, \xi)$
of $\mathcal{F}$ above $s$ such that $g$ is quasi-finite at $t$.
\end{lemma}

\begin{proof}
We may replace $S$ by an affine neighbourhood of $s$. By
Lemma \ref{lemma-impure-finite-presentation}
we may assume that we have an impurity $(g : T \to S, t' \leadsto t, \xi)$
of such that $g$ is locally of finite type and $t$ a closed point of the
fibre of $g$ above $s$. We may replace $T$ by the reduced induced
scheme structure on $\overline{\{t'\}}$. Let
$Z = \overline{\{\xi\}} \subset X_T$. By assumption $Z_t = \emptyset$
and the image of $Z \to T$ contains $t'$. By
More on Morphisms,
Lemma \ref{more-morphisms-lemma-relative-assassin-in-neighbourhood}
there exists a nonempty open $V \subset Z$ such that for any
$w \in f(V)$ any generic point $\xi'$ of $V_w$ is in
$\text{Ass}_{X_T/T}(\mathcal{F}_T)$. By
More on Morphisms, Lemma \ref{more-morphisms-lemma-nonempty-generic-fibre}
there exists a nonempty open $W \subset T$ with $W \subset f(V)$. By
More on Morphisms, Lemma
\ref{more-morphisms-lemma-quasi-finite-quasi-section-meeting-nearby-open-X}
there exists a closed subscheme $T' \subset T$ such that
$t \in T'$, $T' \to S$ is quasi-finite at $t$, and there exists a point
$z \in T' \cap W$, $z \leadsto t$ which does not map to $s$.
Choose any generic point $\xi'$ of the nonempty scheme $V_z$.
Then $(T' \to S, z \leadsto t, \xi')$ is the desired impurity.
\end{proof}

\noindent
In the following we will use the henselization
$S^h = \Spec(\mathcal{O}_{S, s}^h)$
of $S$ at $s$, see
\'Etale Cohomology,
Definition \ref{etale-cohomology-definition-etale-local-rings}.
Since $S^h \to S$ maps to closed point of $S^h$ to $s$ and
induces an isomorphism of residue fields, we will indicate
$s \in S^h$ this closed point also. Thus $(S^h, s) \to (S, s)$ is
a morphism of pointed schemes.

\begin{lemma}
\label{lemma-impurity-on-henselization}
In Situation \ref{situation-pre-pure}.
If there exists an impurity $(S^h \to S, s' \leadsto s, \xi)$
of $\mathcal{F}$ above $s$ then there exists an impurity
$(T \to S, t' \leadsto t, \xi)$ of $\mathcal{F}$ above $s$
where $(T, t) \to (S, s)$ is an elementary \'etale neighbourhood.
\end{lemma}

\begin{proof}
We may replace $S$ by an affine neighbourhood of $s$.
Say $S = \Spec(A)$ and $s$ corresponds to the prime
$\mathfrak p \subset A$. Then
$\mathcal{O}_{S, s}^h = \colim_{(T, t)} \Gamma(T, \mathcal{O}_T)$
where the limit is over the opposite of the
cofiltered category of affine elementary \'etale neighbourhoods
$(T, t)$ of $(S, s)$, see
More on Morphisms,
Lemma \ref{more-morphisms-lemma-describe-henselization}
and its proof. Hence $S^h = \lim_i T_i$ and we win by
Lemma \ref{lemma-impure-limit}.
\end{proof}

\begin{lemma}
\label{lemma-pure-along-X-s}
In Situation \ref{situation-pre-pure} the following
are equivalent
\begin{enumerate}
\item there exists an impurity $(S^h \to S, s' \leadsto s, \xi)$
of $\mathcal{F}$ above $s$ where $S^h$ is the henselization of $S$ at $s$,
\item there exists an impurity $(T \to S, t' \leadsto t, \xi)$
of $\mathcal{F}$ above $s$ such that $(T, t) \to (S, s)$ is an
elementary \'etale neighbourhood, and
\item there exists an impurity $(T \to S, t' \leadsto t, \xi)$
of $\mathcal{F}$ above $s$ such that $T \to S$ is quasi-finite at $t$.
\end{enumerate}
\end{lemma}

\begin{proof}
As an \'etale morphism is locally quasi-finite it is clear that
(2) implies (3). We have seen that (3) implies (2) in
Lemma \ref{lemma-quasi-finite-impurity-elementary}.
We have seen that (1) implies (2) in
Lemma \ref{lemma-impurity-on-henselization}.
Finally, if $(T \to S, t' \leadsto t, \xi)$ is an impurity
of $\mathcal{F}$ above $s$ such that $(T, t) \to (S, s)$ is an
elementary \'etale neighbourhood, then we can choose a factorization
$S^h \to T \to S$ of the structure morphism $S^h \to S$.
Choose any point $s' \in S^h$ mapping to $t'$ and choose any
$\xi' \in X_{s'}$ mapping to $\xi \in X_{t'}$. Then
$(S^h \to S, s' \leadsto s, \xi')$ is an impurity of
$\mathcal{F}$ above $s$. We omit the details.
\end{proof}





\section{Relatively pure modules}
\label{section-pure}

\noindent
The notion of a module pure relative to a base was introduced in \cite{GruRay}.

\begin{definition}
\label{definition-pure}
Let $f : X \to S$ be a morphism of schemes which is of finite type.
Let $\mathcal{F}$ be a finite type quasi-coherent $\mathcal{O}_X$-module.
\begin{enumerate}
\item Let $s \in S$. We say $\mathcal{F}$ is {\it pure along $X_s$}
if there is no impurity $(g : T \to S, t' \leadsto t, \xi)$
of $\mathcal{F}$ above $s$ with $(T, t) \to (S, s)$ an
elementary \'etale neighbourhood.
\item We say $\mathcal{F}$ is {\it universally pure along $X_s$}
if there does not exist any impurity of $\mathcal{F}$ above $s$.
\item We say that $X$ is {\it pure along $X_s$} if $\mathcal{O}_X$
is pure along $X_s$.
\item We say $\mathcal{F}$ is {\it universally $S$-pure}, or
{\it universally pure relative to $S$} if $\mathcal{F}$ is universally
pure along $X_s$ for every $s \in S$.
\item We say $\mathcal{F}$ is {\it $S$-pure}, or
{\it pure relative to $S$} if $\mathcal{F}$ is pure along $X_s$
for every $s \in S$.
\item We say that $X$ is {\it $S$-pure} or {\it pure relative to $S$}
if $\mathcal{O}_X$ is pure relative to $S$.
\end{enumerate}
\end{definition}

\noindent
We intentionally restrict ourselves here to morphisms which are
of finite type and not just morphisms which are locally of
finite type, see
Remark \ref{remark-discuss-finite-type}
for a discussion. In the situation of the definition
Lemma \ref{lemma-pure-along-X-s}
tells us that the following are equivalent
\begin{enumerate}
\item $\mathcal{F}$ is pure along $X_s$,
\item there is no impurity $(g : T \to S, t' \leadsto t, \xi)$ with $g$
quasi-finite at $t$,
\item there does not exist any impurity of the form
$(S^h \to S, s' \leadsto s, \xi)$, where $S^h$ is the henselization
of $S$ at $s$.
\end{enumerate}
If we denote $X^h = X \times_S S^h$ and $\mathcal{F}^h$ the pullback
of $\mathcal{F}$ to $X^h$, then we can formulate the last condition
in the following more positive way:
\begin{enumerate}
\item[(4)] All points of $\text{Ass}_{X^h/S^h}(\mathcal{F}^h)$ specialize
to points of $X_s$.
\end{enumerate}
In particular, it is clear that $\mathcal{F}$ is pure along $X_s$
if and only if the pullback of $\mathcal{F}$ to
$X \times_S \Spec(\mathcal{O}_{S, s})$ is pure along $X_s$.

\begin{remark}
\label{remark-discuss-finite-type}
Let $f : X \to S$ be a morphism which is locally of finite type
and $\mathcal{F}$ a quasi-coherent finite type $\mathcal{O}_X$-module.
In this case it is still true that (1) and (2) above are equivalent
because the proof of
Lemma \ref{lemma-quasi-finite-impurity-elementary}
does not use that $f$ is quasi-compact. It is also clear that
(3) and (4) are equivalent. However, we don't know if (1) and (3) are
equivalent. In this case it may sometimes be more convenient to define
purity using the equivalent conditions (3) and (4) as is done in \cite{GruRay}.
On the other hand, for many applications it seems that the correct notion
is really that of being universally pure.
\end{remark}

\noindent
A natural question to ask is if the property of being pure relative to
the base is preserved by base change, i.e., if being pure is the same
thing as being universally pure. It turns out that this is true
over Noetherian base schemes (see
Lemma \ref{lemma-Noetherian-base-change}),
or if the sheaf is flat (see
Lemmas \ref{lemma-finite-type-flat-pure-along-fibre-is-universal} and
\ref{lemma-finite-type-flat-pure-is-universal}).
It is not true in general, even if the morphism and the sheaf are of
finite presentation, see
Examples, Section \ref{examples-section-pure-not-universally}
for a counter example. First we match our usage of ``universally''
to the usual notion.

\begin{lemma}
\label{lemma-base-change-universally}
Let $f : X \to S$ be a morphism of schemes which is of finite type.
Let $\mathcal{F}$ be a finite type quasi-coherent $\mathcal{O}_X$-module.
Let $s \in S$. The following are equivalent
\begin{enumerate}
\item $\mathcal{F}$ is universally pure along $X_s$, and
\item for every morphism of pointed schemes $(S', s') \to (S, s)$
the pullback $\mathcal{F}_{S'}$ is pure along $X_{s'}$.
\end{enumerate}
In particular, $\mathcal{F}$ is universally pure relative to $S$ if and
only if every base change $\mathcal{F}_{S'}$ of $\mathcal{F}$ is
pure relative to $S'$.
\end{lemma}

\begin{proof}
This is formal.
\end{proof}

\begin{lemma}
\label{lemma-quasi-finite-base-change}
Let $f : X \to S$ be a morphism of schemes which is of finite type.
Let $\mathcal{F}$ be a finite type quasi-coherent $\mathcal{O}_X$-module.
Let $s \in S$. Let $(S', s') \to (S, s)$ be a morphism of pointed schemes.
If $S' \to S$ is quasi-finite at $s'$ and $\mathcal{F}$ is pure along $X_s$,
then $\mathcal{F}_{S'}$ is pure along $X_{s'}$.
\end{lemma}

\begin{proof}
It $(T \to S', t' \leadsto t, \xi)$ is an impurity of
$\mathcal{F}_{S'}$ above $s'$ with $T \to S'$ quasi-finite at $t$,
then $(T \to S, t' \to t, \xi)$ is an impurity of $\mathcal{F}$
above $s$ with $T \to S$ quasi-finite at $t$, see
Morphisms, Lemma \ref{morphisms-lemma-composition-quasi-finite}.
Hence the lemma follows immediately from the characterization (2)
of purity given following
Definition \ref{definition-pure}.
\end{proof}

\begin{lemma}
\label{lemma-Noetherian-base-change}
Let $f : X \to S$ be a morphism of schemes which is of finite type.
Let $\mathcal{F}$ be a finite type quasi-coherent $\mathcal{O}_X$-module.
Let $s \in S$. If $\mathcal{O}_{S, s}$ is Noetherian then
$\mathcal{F}$ is pure along $X_s$ if and only if $\mathcal{F}$
is universally pure along $X_s$.
\end{lemma}

\begin{proof}
First we may replace $S$ by $\Spec(\mathcal{O}_{S, s})$, i.e.,
we may assume that $S$ is Noetherian. Next, use
Lemma \ref{lemma-Noetherian-impurity-quasi-finite}
and characterization (2) of purity given in discussion following
Definition \ref{definition-pure}
to conclude.
\end{proof}

\noindent
Purity satisfies flat descent.

\begin{lemma}
\label{lemma-flat-descend-pure}
Let $f : X \to S$ be a morphism of schemes which is of finite type.
Let $\mathcal{F}$ be a finite type quasi-coherent $\mathcal{O}_X$-module.
Let $s \in S$. Let $(S', s') \to (S, s)$ be a morphism of pointed schemes.
Assume $S' \to S$ is flat at $s'$.
\begin{enumerate}
\item If $\mathcal{F}_{S'}$ is pure along $X_{s'}$,
then $\mathcal{F}$ is pure along $X_s$.
\item If $\mathcal{F}_{S'}$ is universally pure along $X_{s'}$,
then $\mathcal{F}$ is universally pure along $X_s$.
\end{enumerate}
\end{lemma}

\begin{proof}
Let $(T \to S, t' \leadsto t, \xi)$ be an impurity of
$\mathcal{F}$ above $s$. Set $T_1 = T \times_S S'$, and let $t_1$
be the unique point of $T_1$ mapping to $t$ and $s'$. Since
$T_1 \to T$ is flat at $t_1$, see
Morphisms, Lemma \ref{morphisms-lemma-base-change-flat},
there exists a specialization $t'_1 \leadsto t_1$ lying over
$t' \leadsto t$, see
Algebra, Section \ref{algebra-section-going-up}.
Choose a point $\xi_1 \in X_{t'_1}$ which corresponds to a generic
point of $\Spec(\kappa(t'_1) \otimes_{\kappa(t')} \kappa(\xi))$, see
Schemes, Lemma \ref{schemes-lemma-points-fibre-product}.
By
Divisors, Lemma \ref{divisors-lemma-base-change-relative-assassin}
we see that $\xi_1 \in \text{Ass}_{X_{T_1}/T_1}(\mathcal{F}_{T_1})$.
As the Zariski closure of $\{\xi_1\}$ in $X_{T_1}$ maps into the
Zariski closure of $\{\xi\}$ in $X_T$ we conclude that
this closure is disjoint from $X_{t_1}$. Hence
$(T_1 \to S', t'_1 \leadsto t_1, \xi_1)$
is an impurity of $\mathcal{F}_{S'}$ above $s'$.
In other words we have proved the contrapositive to part (2) of the
lemma. Finally, if $(T, t) \to (S, s)$ is an elementary
\'etale neighbourhood, then $(T_1, t_1) \to (S', s')$ is an
elementary \'etale neighbourhood too, and in this way we see that (1) holds.
\end{proof}

\begin{lemma}
\label{lemma-supported-on-closed}
Let $i : Z \to X$ be a closed immersion of schemes of finite type over
a scheme $S$. Let $s \in S$. Let $\mathcal{F}$ be a
finite type, quasi-coherent sheaf on $Z$. Then $\mathcal{F}$ is
(universally) pure along $Z_s$ if and only if $i_*\mathcal{F}$
is (universally) pure along $X_s$.
\end{lemma}

\begin{proof}
This follows from
Divisors, Lemma \ref{divisors-lemma-relative-weak-assassin-finite}.
\end{proof}








\section{Examples of relatively pure sheaves}
\label{section-examples-pure-sheaves}

\noindent
Here are some example cases where it is possible to see what purity means.

\begin{lemma}
\label{lemma-proper-pure}
Let $f : X \to S$ be a morphism of schemes which is of finite type.
Let $\mathcal{F}$ be a finite type quasi-coherent $\mathcal{O}_X$-module.
\begin{enumerate}
\item If the support of $\mathcal{F}$ is proper over $S$, then
$\mathcal{F}$ is universally pure relative to $S$.
\item If $f$ is proper, then
$\mathcal{F}$ is universally pure relative to $S$.
\item If $f$ is proper, then $X$ is universally pure relative to $S$.
\end{enumerate}
\end{lemma}

\begin{proof}
First we reduce (1) to (2). Namely, let $Z \subset X$ be the
scheme theoretic support of $\mathcal{F}$. Let $i : Z \to X$
be the corresponding closed immersion and write
$\mathcal{F} = i_*\mathcal{G}$ for some finite type quasi-coherent
$\mathcal{O}_Z$-module $\mathcal{G}$, see
Morphisms, Section \ref{morphisms-section-support}.
In case (1) $Z \to S$ is proper by assumption.
Thus by Lemma \ref{lemma-supported-on-closed} case (1) reduces to case (2).

\medskip\noindent
Assume $f$ is proper.
Let $(g : T \to S, t' \leadsto t, \xi)$ be an impurity of $\mathcal{F}$
above $s \in S$. Since $f$ is proper, it is universally closed. Hence
$f_T : X_T \to T$ is closed. Since $f_T(\xi) = t'$ this implies that
$t \in f(\overline{\{\xi\}})$ which is a contradiction.
\end{proof}

\begin{lemma}
\label{lemma-quasi-finite-pure}
Let $f : X \to S$ be a separated, finite type morphism of schemes.
Let $\mathcal{F}$ be a finite type, quasi-coherent $\mathcal{O}_X$-module.
Assume that $\text{Supp}(\mathcal{F}_s)$ is finite for every $s \in S$.
Then the following are equivalent
\begin{enumerate}
\item $\mathcal{F}$ is pure relative to $S$,
\item the scheme theoretic support of $\mathcal{F}$ is finite over $S$, and
\item $\mathcal{F}$ is universally pure relative to $S$.
\end{enumerate}
In particular, given a quasi-finite separated morphism $X \to S$ we see
that $X$ is pure relative to $S$ if and only if $X \to S$ is finite.
\end{lemma}

\begin{proof}
Let $Z \subset X$ be the scheme theoretic support of $\mathcal{F}$, see
Morphisms, Definition \ref{morphisms-definition-scheme-theoretic-support}.
Then $Z \to S$ is a separated, finite type morphism of schemes with
finite fibres. Hence it is separated and quasi-finite, see
Morphisms, Lemma \ref{morphisms-lemma-quasi-finite}.
By
Lemma \ref{lemma-supported-on-closed}
it suffices to prove the lemma for $Z \to S$ and the sheaf $\mathcal{F}$
viewed as a finite type quasi-coherent module on $Z$. Hence we may
assume that $X \to S$ is separated and quasi-finite and that
$\text{Supp}(\mathcal{F}) = X$.

\medskip\noindent
It follows from
Lemma \ref{lemma-proper-pure}
and
Morphisms, Lemma \ref{morphisms-lemma-finite-proper}
that (2) implies (3). Trivially (3) implies (1). Assume (1) holds.
We will prove that (2) holds. It is clear that we may assume $S$ is affine. By
More on Morphisms,
Lemma \ref{more-morphisms-lemma-quasi-finite-separated-pass-through-finite}
we can find a diagram
$$
\xymatrix{
X \ar[rd]_f \ar[rr]_j & & T \ar[ld]^\pi \\
& S &
}
$$
with $\pi$ finite and $j$ a quasi-compact open immersion.
If we show that $j$ is closed, then $j$ is a closed immersion
and we conclude that $f = \pi \circ j$ is finite.
To show that $j$ is closed it suffices to show that specializations
lift along $j$, see
Schemes, Lemma \ref{schemes-lemma-quasi-compact-closed}.
Let $x \in X$, set $t' = j(x)$ and let $t' \leadsto t$ be a specialization.
We have to show $t \in j(X)$. Set $s' = f(x)$ and $s = \pi(t)$ so
$s' \leadsto s$. By
More on Morphisms, Lemma
\ref{more-morphisms-lemma-etale-splits-off-quasi-finite-part-technical}
we can find an elementary \'etale neighbourhood
$(U, u) \to (S, s)$ and a decomposition
$$
T_U = T \times_S U = V \amalg W
$$
into open and closed subschemes, such that $V \to U$ is finite and
there exists a unique point $v$ of $V$ mapping to $u$, and such that
$v$ maps to $t$ in $T$. As $V \to T$ is \'etale, we can lift
generalizations, see
Morphisms, Lemmas \ref{morphisms-lemma-generalizations-lift-flat} and
\ref{morphisms-lemma-etale-flat}.
Hence there exists a specialization $v' \leadsto v$ such that $v'$
maps to $t' \in T$. In particular we see that $v' \in X_U \subset T_U$.
Denote $u' \in U$ the image of $t'$. Note that
$v' \in \text{Ass}_{X_U/U}(\mathcal{F})$ because $X_{u'}$ is a finite
discrete set and $X_{u'} = \text{Supp}(\mathcal{F}_{u'})$.
As $\mathcal{F}$ is pure relative to $S$ we see that $v'$ must
specialize to a point in $X_u$. Since $v$ is the only point of
$V$ lying over $u$ (and since no point of $W$ can be a specialization
of $v'$) we see that $v \in X_u$. Hence $t \in X$.
\end{proof}

\begin{lemma}
\label{lemma-flat-geometrically-integral-fibres-pure}
Let $f : X \to S$ be a finite type, flat morphism of schemes
with geometrically integral fibres. Then $X$ is universally pure
over $S$.
\end{lemma}

\begin{proof}
Let $\xi \in X$ with $s' = f(\xi)$ and $s' \leadsto s$ a specialization
of $S$. If $\xi$ is an associated point of $X_{s'}$, then $\xi$ is the
unique generic point because $X_{s'}$ is an integral scheme. Let
$\xi_0$ be the unique generic point of $X_s$. As $X \to S$ is flat
we can lift $s' \leadsto s$ to a specialization
$\xi' \leadsto \xi_0$ in $X$, see
Morphisms, Lemma \ref{morphisms-lemma-generalizations-lift-flat}.
The $\xi \leadsto \xi'$ because $\xi$ is the generic point of $X_{s'}$
hence $\xi \leadsto \xi_0$. This means that $(\text{id}_S, s' \to s, \xi)$
is not an impurity of $\mathcal{O}_X$ above $s$. Since the assumption
that $f$ is finite type, flat with geometrically integral fibres
is preserved under base change, we see that there doesn't exist an
impurity after any base change. In this way we see that $X$ is
universally $S$-pure.
\end{proof}

\begin{lemma}
\label{lemma-affine-locally-projective-pure}
Let $f : X \to S$ be a finite type, affine morphism of schemes.
Let $\mathcal{F}$ be a finite type quasi-coherent $\mathcal{O}_X$-module
such that $f_*\mathcal{F}$ is locally projective on $S$, see
Properties, Definition \ref{properties-definition-locally-projective}.
Then $\mathcal{F}$ is universally pure over $S$.
\end{lemma}

\begin{proof}
After reducing to the case where $S$ is the spectrum of a henselian
local ring this follows from
Lemma \ref{lemma-explain-why-pure}.
\end{proof}




\section{A criterion for purity}
\label{section-criterion-purity}

\noindent
We first prove that given a flat family of finite type
quasi-coherent sheaves the points in the relative assassin
specialize to points in the relative assassins of nearby fibres
(if they specialize at all).

\begin{lemma}
\label{lemma-associated-point-specializes}
Let $f : X \to S$ be a morphism of schemes of finite type.
Let $\mathcal{F}$ be a quasi-coherent $\mathcal{O}_X$-module of finite type.
Let $s \in S$.
Assume that $\mathcal{F}$ is flat over $S$ at all points of $X_s$.
Let $x' \in \text{Ass}_{X/S}(\mathcal{F})$ with $f(x') = s'$
such that $s' \leadsto s$ is a specialization in $S$. If
$x'$ specializes to a point of $X_s$, then $x' \leadsto x$
with $x \in \text{Ass}_{X_s}(\mathcal{F}_s)$.
\end{lemma}

\begin{proof}
Say $x' \leadsto t$ with $t \in X_s$. Then we can find specializations
$x' \leadsto x \leadsto t$ with $x$ corresponding to a generic
point of an irreducible component of
$\overline{\{x'\}} \cap f^{-1}(\{s\})$. By assumption $\mathcal{F}$ is flat
over $S$ at $x$. By More on Morphisms, Lemma
\ref{more-morphisms-lemma-associated-point-specializes}
we see that $x \in \text{Ass}_{X/S}(\mathcal{F})$ as desired.
\end{proof}

\begin{lemma}
\label{lemma-criterion}
Let $f : X \to S$ be a morphism of schemes of finite type.
Let $\mathcal{F}$ be a quasi-coherent $\mathcal{O}_X$-module
of finite type. Let $s \in S$. Let $(S', s') \to (S, s)$ be an
elementary \'etale neighbourhood and let
$$
\xymatrix{
X \ar[d] & X' \ar[l]^g \ar[d] \\
S & S' \ar[l]
}
$$
be a commutative diagram of morphisms of schemes. Assume
\begin{enumerate}
\item $\mathcal{F}$ is flat over $S$ at all points of $X_s$,
\item $X' \to S'$ is of finite type,
\item $g^*\mathcal{F}$ is pure along $X'_{s'}$,
\item $g : X' \to X$ is \'etale, and
\item $g(X')$ contains $\text{Ass}_{X_s}(\mathcal{F}_s)$.
\end{enumerate}
In this situation $\mathcal{F}$ is pure along $X_s$ if and only
if the image of $X' \to X \times_S S'$ contains the points of
$\text{Ass}_{X \times_S S'/S'}(\mathcal{F} \times_S S')$
lying over points in $S'$ which specialize to $s'$.
\end{lemma}

\begin{proof}
Since the morphism $S' \to S$ is \'etale, we see that if $\mathcal{F}$
is pure along $X_s$, then $\mathcal{F} \times_S S'$ is pure along
$X_s$, see
Lemma \ref{lemma-quasi-finite-base-change}.
Since purity satisfies flat descent, see
Lemma \ref{lemma-flat-descend-pure},
we see that if $\mathcal{F} \times_S S'$ is pure along $X_{s'}$, then
$\mathcal{F}$ is pure along $X_s$. Hence we may replace $S$ by $S'$
and assume that $S = S'$ so that $g : X' \to X$ is an \'etale morphism
between schemes of finite type over $S$. Moreover, we may replace
$S$ by $\Spec(\mathcal{O}_{S, s})$ and assume that $S$ is local.

\medskip\noindent
First, assume that $\mathcal{F}$ is pure along $X_s$.
In this case every point of $\text{Ass}_{X/S}(\mathcal{F})$
specializes to a point of $X_s$ by purity. Hence by
Lemma \ref{lemma-associated-point-specializes}
we see that every point of $\text{Ass}_{X/S}(\mathcal{F})$
specializes to a point of $\text{Ass}_{X_s}(\mathcal{F}_s)$.
Thus every point of $\text{Ass}_{X/S}(\mathcal{F})$ is in the
image of $g$ (as the image is open and contains
$\text{Ass}_{X_s}(\mathcal{F}_s)$).

\medskip\noindent
Conversely, assume that $g(X')$ contains $\text{Ass}_{X/S}(\mathcal{F})$.
Let $S^h = \Spec(\mathcal{O}_{S, s}^h)$ be the henselization
of $S$ at $s$. Denote $g^h : (X')^h \to X^h$ the base change of $g$
by $S^h \to S$, and denote $\mathcal{F}^h$ the pullback of $\mathcal{F}$
to $X^h$. By
Divisors, Lemma \ref{divisors-lemma-base-change-relative-assassin} and
Remark \ref{divisors-remark-base-change-relative-assassin}
the relative assassin $\text{Ass}_{X^h/S^h}(\mathcal{F}^h)$
is the inverse image of $\text{Ass}_{X/S}(\mathcal{F})$ via the projection
$X^h \to X$. As we have assumed that $g(X')$ contains
$\text{Ass}_{X/S}(\mathcal{F})$ we conclude that the base change
$g^h((X')^h) = g(X') \times_S S^h$ contains
$\text{Ass}_{X^h/S^h}(\mathcal{F}^h)$. In this way
we reduce to the case where $S$ is the spectrum of a henselian local ring.
Let $x \in \text{Ass}_{X/S}(\mathcal{F})$. To finish the proof of the
lemma we have to show that $x$ specializes to a point of $X_s$, see
criterion (4) for purity in discussion following
Definition \ref{definition-pure}.
By assumption there exists a $x' \in X'$ such that $g(x') = x$.
As $g : X' \to X$ is \'etale, we see that
$x' \in \text{Ass}_{X'/S}(g^*\mathcal{F})$, see
Lemma \ref{lemma-etale-weak-assassin-up-down} (applied to
the morphism of fibres $X'_w \to X_w$ where $w \in S$ is the image of $x'$).
Since $g^*\mathcal{F}$ is pure along $X'_s$ we see that $x' \leadsto y$
for some $y \in X'_s$. Hence $x = g(x') \leadsto g(y)$ and
$g(y) \in X_s$ as desired.
\end{proof}

\begin{lemma}
\label{lemma-finite-type-flat-pure-along-fibre-is-universal}
Let $f : X \to S$ be a morphism of schemes.
Let $\mathcal{F}$ be a quasi-coherent $\mathcal{O}_X$-module.
Let $s \in S$.
Assume
\begin{enumerate}
\item $f$ is of finite type,
\item $\mathcal{F}$ is of finite type,
\item $\mathcal{F}$ is flat over $S$ at all points of $X_s$, and
\item $\mathcal{F}$ is pure along $X_s$.
\end{enumerate}
Then $\mathcal{F}$ is universally pure along $X_s$.
\end{lemma}

\begin{proof}
We first make a preliminary remark. Suppose that $(S', s') \to (S, s)$
is an elementary \'etale neighbourhood. Denote $\mathcal{F}'$ the
pullback of $\mathcal{F}$ to $X' = X \times_S S'$.
By the discussion following
Definition \ref{definition-pure}
we see that $\mathcal{F}'$ is pure along $X'_{s'}$. Moreover, $\mathcal{F}'$
is flat over $S'$ along $X'_{s'}$. Then it suffices to prove
that $\mathcal{F}'$ is universally pure along $X'_{s'}$. Namely, given
any morphism $(T, t) \to (S, s)$ of pointed schemes
the fibre product $(T', t') = (T \times_S S', (t, s'))$ is flat over $(T, t)$
and hence if $\mathcal{F}_{T'}$ is pure along $X_{t'}$ then
$\mathcal{F}_T$ is pure along $X_t$ by
Lemma \ref{lemma-flat-descend-pure}.
Thus during the proof we may always replace $(s, S)$ by an elementary
\'etale neighbourhood.
We may also replace $S$ by $\Spec(\mathcal{O}_{S, s})$
due to the local nature of the problem.

\medskip\noindent
Choose an elementary \'etale neighbourhood $(S', s') \to (S, s)$ and
a commutative diagram
$$
\xymatrix{
X \ar[d] & X' \ar[l]^g \ar[d] \\
S & \Spec(\mathcal{O}_{S', s'}) \ar[l]
}
$$
such that $X' \to X \times_S \Spec(\mathcal{O}_{S', s'})$
is \'etale, $X_s = g((X')_{s'})$, the scheme $X'$ is affine,
and such that $\Gamma(X', g^*\mathcal{F})$ is a free
$\mathcal{O}_{S', s'}$-module, see
Lemma \ref{lemma-finite-type-flat-along-fibre-free-variant}.
Note that $X' \to \Spec(\mathcal{O}_{S', s'})$ is of finite type
(as a quasi-compact morphism which is the composition of an \'etale morphism
and the base change of a finite type morphism).
By our preliminary remarks in the first paragraph of the proof
we may replace $S$ by $\Spec(\mathcal{O}_{S', s'})$. Hence
we may assume there exists a commutative diagram
$$
\xymatrix{
X \ar[dr] & & X' \ar[ll]^g \ar[ld] \\
& S &
}
$$
of schemes of finite type over $S$, where $g$ is \'etale, $X_s \subset g(X')$,
with $S$ local with closed point $s$, with $X'$ affine, and with
$\Gamma(X', g^*\mathcal{F})$ a free $\Gamma(S, \mathcal{O}_S)$-module.
Note that in this case $g^*\mathcal{F}$ is universally pure over $S$, see
Lemma \ref{lemma-affine-locally-projective-pure}.

\medskip\noindent
In this situation we apply
Lemma \ref{lemma-criterion}
to deduce that $\text{Ass}_{X/S}(\mathcal{F}) \subset g(X')$
from our assumption that $\mathcal{F}$ is pure along $X_s$
and flat over $S$ along $X_s$. By
Divisors, Lemma \ref{divisors-lemma-base-change-relative-assassin} and
Remark \ref{divisors-remark-base-change-relative-assassin}
we see that for any morphism of pointed schemes
$(T, t) \to (S, s)$ we have
$$
\text{Ass}_{X_T/T}(\mathcal{F}_T) \subset
(X_T \to X)^{-1}(\text{Ass}_{X/S}(\mathcal{F})) \subset
g(X') \times_S T = g_T(X'_T).
$$
Hence by
Lemma \ref{lemma-criterion}
applied to the base change of our displayed diagram to $(T, t)$
we conclude that $\mathcal{F}_T$ is pure along $X_t$ as desired.
\end{proof}

\begin{lemma}
\label{lemma-finite-type-flat-pure-is-universal}
Let $f : X \to S$ be a finite type morphism of schemes.
Let $\mathcal{F}$ be a finite type quasi-coherent $\mathcal{O}_X$-module.
Assume $\mathcal{F}$ is flat over $S$. In this case
$\mathcal{F}$ is pure relative to $S$ if and only if $\mathcal{F}$
is universally pure relative to $S$.
\end{lemma}

\begin{proof}
Immediate consequence of
Lemma \ref{lemma-finite-type-flat-pure-along-fibre-is-universal}
and the definitions.
\end{proof}

\begin{lemma}
\label{lemma-limit-purity}
Let $I$ be a directed set.
Let $(S_i, g_{ii'})$ be an inverse system of affine schemes over $I$.
Set $S = \lim_i S_i$ and $s \in S$.
Denote $g_i : S \to S_i$ the projections and set $s_i = g_i(s)$.
Suppose that $f : X \to S$ is a morphism of finite presentation,
$\mathcal{F}$ a quasi-coherent $\mathcal{O}_X$-module of finite presentation
which is pure along $X_s$ and flat over $S$ at all points of $X_s$.
Then there exists an $i \in I$, a morphism of finite presentation
$X_i \to S_i$, a quasi-coherent $\mathcal{O}_{X_i}$-module $\mathcal{F}_i$
of finite presentation which is pure along $(X_i)_{s_i}$ and flat over $S_i$
at all points of $(X_i)_{s_i}$ such that $X \cong X_i \times_{S_i} S$
and such that the pullback of $\mathcal{F}_i$ to $X$ is isomorphic
to $\mathcal{F}$.
\end{lemma}

\begin{proof}
Let $U \subset X$ be the set of points where $\mathcal{F}$ is
flat over $S$. By
More on Morphisms, Theorem \ref{more-morphisms-theorem-openness-flatness}
this is an open subscheme of $X$. By assumption $X_s \subset U$.
As $X_s$ is quasi-compact, we can find a quasi-compact open
$U' \subset U$ with $X_s \subset U'$. By
Limits, Lemma \ref{limits-lemma-descend-finite-presentation}
we can find an $i \in I$ and a morphism of finite presentation
$f_i : X_i \to S_i$ whose base change to $S$ is isomorphic to $f_i$.
Fix such a choice and set $X_{i'} = X_i \times_{S_i} S_{i'}$.
Then $X = \lim_{i'} X_{i'}$ with affine transition morphisms. By
Limits, Lemma \ref{limits-lemma-descend-modules-finite-presentation}
we can, after possible increasing $i$ assume there exists a
quasi-coherent $\mathcal{O}_{X_i}$-module $\mathcal{F}_i$
of finite presentation whose base change to $S$ is isomorphic to
$\mathcal{F}$. By
Limits, Lemma \ref{limits-lemma-descend-opens}
after possibly increasing $i$ we may assume there exists an
open $U'_i \subset X_i$ whose inverse image in $X$ is $U'$.
Note that in particular $(X_i)_{s_i} \subset U'_i$. By
Limits, Lemma \ref{limits-lemma-descend-module-flat-finite-presentation}
(after increasing $i$ once more)
we may assume that $\mathcal{F}_i$ is flat on $U'_i$.
In particular we see that $\mathcal{F}_i$ is flat along $(X_i)_{s_i}$.

\medskip\noindent
Next, we use
Lemma \ref{lemma-finite-presentation-flat-along-fibre}
to choose an elementary \'etale neighbourhood
$(S_i', s_i') \to (S_i, s_i)$ and a commutative diagram of schemes
$$
\xymatrix{
X_i \ar[d] & X_i' \ar[l]^{g_i} \ar[d] \\
S_i & S_i' \ar[l]
}
$$
such that $g_i$ is \'etale, $(X_i)_{s_i} \subset g_i(X_i')$, the schemes
$X_i'$, $S_i'$ are affine, and such that
$\Gamma(X_i', g_i^*\mathcal{F}_i)$ is a projective
$\Gamma(S_i', \mathcal{O}_{S_i'})$-module.
Note that $g_i^*\mathcal{F}_i$ is universally pure over $S'_i$, see
Lemma \ref{lemma-affine-locally-projective-pure}.
We may base change the diagram above to a diagram with morphisms
$(S'_{i'}, s'_{i'}) \to (S_{i'}, s_{i'})$ and
$g_{i'} : X'_{i'} \to X_{i'}$ over $S_{i'}$
for any $i' \geq i$ and we may base change the diagram to a diagram
with morphisms $(S', s') \to (S, s)$ and $g : X' \to X$ over $S$.

\medskip\noindent
At this point we can use our criterion for purity.
Set $W'_i \subset X_i \times_{S_i} S'_i$ equal to the image of the
\'etale morphism $X'_i \to X_i \times_{S_i} S'_i$. For every $i' \geq i$
we have similarly the image $W'_{i'} \subset X_{i'} \times_{S_{i'}} S'_{i'}$
and we have the image $W' \subset X \times_S S'$. Taking images commutes
with base change, hence $W'_{i'} = W'_i \times_{S'_i} S'_{i'}$ and
$W' = W_i \times_{S'_i} S'$. Because
$\mathcal{F}$ is pure along $X_s$ the
Lemma \ref{lemma-criterion}
implies that
\begin{equation}
\label{equation-inclusion}
f^{-1}(\Spec(\mathcal{O}_{S', s'})) \cap
\text{Ass}_{X \times_S S'/S'}(\mathcal{F} \times_S S') \subset W'
\end{equation}
By
More on Morphisms,
Lemma \ref{more-morphisms-lemma-relative-assassin-constructible}
we see that
$$
E = \{t \in S' \mid \text{Ass}_{X_t}(\mathcal{F}_t) \subset W' \}
\quad\text{and}\quad
E_{i'} = \{t \in S'_{i'} \mid
\text{Ass}_{X_t}(\mathcal{F}_{i', t}) \subset W'_{i'} \}
$$
are locally constructible subsets of $S'$ and $S'_{i'}$. By
More on Morphisms,
Lemma \ref{more-morphisms-lemma-base-change-assassin-in-U}
we see that $E_{i'}$ is the inverse image of $E_i$ under the morphism
$S'_{i'} \to S'_i$ and that $E$ is the inverse image of $E_i$ under
the morphism $S' \to S'_i$. Thus
Equation (\ref{equation-inclusion})
is equivalent to the assertion that
$\Spec(\mathcal{O}_{S', s'})$ maps into $E_i$. As
$\mathcal{O}_{S', s'} =
\colim_{i' \geq i} \mathcal{O}_{S'_{i'}, s'_{i'}}$
we see that $\Spec(\mathcal{O}_{S'_{i'}, s'_{i'}})$
maps into $E_i$ for some $i' \geq i$, see
Limits, Lemma \ref{limits-lemma-limit-contained-in-constructible}.
Then, applying
Lemma \ref{lemma-criterion}
to the situation over $S_{i'}$,
we conclude that $\mathcal{F}_{i'}$ is pure along $(X_{i'})_{s_{i'}}$.
\end{proof}

\begin{lemma}
\label{lemma-flat-finite-presentation-purity-open}
Let $f : X \to S$ be a morphism of finite presentation.
Let $\mathcal{F}$ be a quasi-coherent $\mathcal{O}_X$-module
of finite presentation flat over $S$. Then the set
$$
U = \{s \in S \mid \mathcal{F}\text{ is pure along }X_s\}
$$
is open in $S$.
\end{lemma}

\begin{proof}
Let $s \in U$. Using
Lemma \ref{lemma-finite-presentation-flat-along-fibre}
we can find an elementary \'etale neighbourhood
$(S', s') \to (S, s)$ and a commutative diagram
$$
\xymatrix{
X \ar[d] & X' \ar[l]^g \ar[d] \\
S & S' \ar[l]
}
$$
such that $g$ is \'etale, $X_s \subset g(X')$, the schemes
$X'$, $S'$ are affine, and such that $\Gamma(X', g^*\mathcal{F})$
is a projective $\Gamma(S', \mathcal{O}_{S'})$-module.
Note that $g^*\mathcal{F}$ is universally pure over $S'$, see
Lemma \ref{lemma-affine-locally-projective-pure}.
Set $W' \subset X \times_S S'$ equal to the image of the \'etale morphism
$X' \to X \times_S S'$. Note that $W$ is open and quasi-compact over
$S'$. Set
$$
E = \{t \in S' \mid \text{Ass}_{X_t}(\mathcal{F}_t) \subset W' \}.
$$
By
More on Morphisms,
Lemma \ref{more-morphisms-lemma-relative-assassin-constructible}
$E$ is a constructible subset of $S'$. By
Lemma \ref{lemma-criterion}
we see that $\Spec(\mathcal{O}_{S', s'}) \subset E$.
By
Morphisms, Lemma \ref{morphisms-lemma-constructible-containing-open}
we see that $E$ contains an open neighbourhood $V'$ of $s'$.
Applying
Lemma \ref{lemma-criterion}
once more we see that for any point $s_1$ in the image of $V'$ in $S$
the sheaf $\mathcal{F}$ is pure along $X_{s_1}$. Since
$S' \to S$ is \'etale the image of $V'$ in $S$ is open and we win.
\end{proof}


\section{How purity is used}
\label{section-applications-purity}

\noindent
Here are some examples of how purity can be used. The first lemma
actually uses a slightly weaker form of purity.

\begin{lemma}
\label{lemma-injectivity-map-source-flat-pure}
Let $f : X \to S$ be a morphism of finite type.
Let $\mathcal{F}$ be a quasi-coherent sheaf of finite type on $X$.
Assume $S$ is local with closed point $s$.
Assume $\mathcal{F}$ is pure along $X_s$ and
that $\mathcal{F}$ is flat over $S$.
Let $\varphi : \mathcal{F} \to \mathcal{G}$ of quasi-coherent
$\mathcal{O}_X$-modules. Then the following are equivalent
\begin{enumerate}
\item the map on stalks $\varphi_x$ is injective for all
$x \in \text{Ass}_{X_s}(\mathcal{F}_s)$, and
\item $\varphi$ is injective.
\end{enumerate}
\end{lemma}

\begin{proof}
Let $\mathcal{K} = \Ker(\varphi)$. Our goal is to prove that
$\mathcal{K} = 0$. In order to do this it suffices to prove that
$\text{WeakAss}_X(\mathcal{K}) = \emptyset$, see
Divisors, Lemma \ref{divisors-lemma-weakly-ass-zero}.
We have
$\text{WeakAss}_X(\mathcal{K}) \subset \text{WeakAss}_X(\mathcal{F})$, see
Divisors, Lemma \ref{divisors-lemma-ses-weakly-ass}.
As $\mathcal{F}$ is flat we see from
Lemma \ref{lemma-bourbaki-finite-type-general-base}
that $\text{WeakAss}_X(\mathcal{F}) \subset \text{Ass}_{X/S}(\mathcal{F})$.
By purity any point $x'$ of $\text{Ass}_{X/S}(\mathcal{F})$
is a generalization of a point of $X_s$, and hence is the
specialization of a point $x \in \text{Ass}_{X_s}(\mathcal{F}_s)$, by
Lemma \ref{lemma-associated-point-specializes}.
Hence the injectivity of $\varphi_x$ implies the injectivity of
$\varphi_{x'}$, whence $\mathcal{K}_{x'} = 0$.
\end{proof}

\begin{proposition}
\label{proposition-finite-presentation-flat-pure-is-projective}
Let $f : X \to S$ be an affine, finitely presented morphism of schemes.
Let $\mathcal{F}$ be a quasi-coherent $\mathcal{O}_X$-module of
finite presentation, flat over $S$. Then the following
are equivalent
\begin{enumerate}
\item $f_*\mathcal{F}$ is locally projective on $S$, and
\item $\mathcal{F}$ is pure relative to $S$.
\end{enumerate}
In particular, given a ring map $A \to B$ of finite presentation and
a finitely presented $B$-module $N$ flat over $A$ we have:
$N$ is projective as an $A$-module if and only if $\widetilde{N}$
on $\Spec(B)$ is pure relative to $\Spec(A)$.
\end{proposition}

\begin{proof}
The implication (1) $\Rightarrow$ (2) is
Lemma \ref{lemma-affine-locally-projective-pure}.
Assume $\mathcal{F}$ is pure relative to $S$.
Note that by
Lemma \ref{lemma-finite-type-flat-pure-along-fibre-is-universal}
this implies $\mathcal{F}$ remains pure after any base change. By
Descent, Lemma \ref{descent-lemma-locally-projective-descends}
it suffices to prove $f_*\mathcal{F}$ is fpqc locally projective on $S$.
Pick $s \in S$. We will prove that the restriction of
$f_*\mathcal{F}$ to an \'etale neighbourhood of $s$ is locally projective.
Namely, by
Lemma \ref{lemma-finite-presentation-flat-along-fibre},
after replacing $S$ by an affine elementary \'etale
neighbourhood of $s$, we may assume there exists a diagram
$$
\xymatrix{
X \ar[dr] & & X' \ar[ll]^g \ar[ld] \\
& S &
}
$$
of schemes affine and of finite presentation over $S$,
where $g$ is \'etale, $X_s \subset g(X')$, and with
$\Gamma(X', g^*\mathcal{F})$ a projective $\Gamma(S, \mathcal{O}_S)$-module.
Note that in this case $g^*\mathcal{F}$ is universally pure over $S$, see
Lemma \ref{lemma-affine-locally-projective-pure}.
Hence by
Lemma \ref{lemma-criterion}
we see that the open $g(X')$ contains the points of
$\text{Ass}_{X/S}(\mathcal{F})$ lying over $\Spec(\mathcal{O}_{S, s})$.
Set
$$
E = \{t \in S \mid \text{Ass}_{X_t}(\mathcal{F}_t) \subset g(X') \}.
$$
By
More on Morphisms,
Lemma \ref{more-morphisms-lemma-relative-assassin-constructible}
$E$ is a constructible subset of $S$. We have seen that
$\Spec(\mathcal{O}_{S, s}) \subset E$. By
Morphisms, Lemma \ref{morphisms-lemma-constructible-containing-open}
we see that $E$ contains an open neighbourhood of $s$. Hence after
replacing $S$ by an affine neighbourhood of $s$ we may assume that
$\text{Ass}_{X/S}(\mathcal{F}) \subset g(X')$.
By
Lemma \ref{lemma-base-change-universally-flat}
this means that
$$
\Gamma(X, \mathcal{F}) \longrightarrow \Gamma(X', g^*\mathcal{F})
$$
is $\Gamma(S, \mathcal{O}_S)$-universally injective.
By Algebra, Lemma \ref{algebra-lemma-pure-submodule-ML}
we conclude that $\Gamma(X, \mathcal{F})$ is Mittag-Leffler as an
$\Gamma(S, \mathcal{O}_S)$-module. Since
$\Gamma(X, \mathcal{F})$ is countably generated and flat as a
$\Gamma(S, \mathcal{O}_S)$-module, we conclude
it is projective by
Algebra, Lemma \ref{algebra-lemma-countgen-projective}.
\end{proof}

\noindent
We can use the proposition to improve some of our earlier results.
The following lemma is an improvement of
Proposition \ref{proposition-finite-presentation-flat-at-point}.

\begin{lemma}
\label{lemma-flat-finite-presentation-affine-neighbourhood-projective}
Let $f : X \to S$ be a morphism which is locally of finite presentation.
Let $\mathcal{F}$ be a quasi-coherent $\mathcal{O}_X$-module which is
of finite presentation. Let $x \in X$ with $s = f(x) \in S$.
If $\mathcal{F}$ is flat at $x$ over $S$ there exists an affine
elementary \'etale neighbourhood $(S', s') \to (S, s)$ and
an affine open $U' \subset X \times_S S'$ which contains $x' = (x, s')$
such that $\Gamma(U', \mathcal{F}|_{U'})$ is a projective
$\Gamma(S', \mathcal{O}_{S'})$-module.
\end{lemma}

\begin{proof}
During the proof we may replace $X$ by an open neighbourhood of $x$
and we may replace $S$ by an elementary \'etale neighbourhood of $s$.
Hence, by openness of flatness (see
More on Morphisms, Theorem \ref{more-morphisms-theorem-openness-flatness})
we may assume that $\mathcal{F}$ is flat over $S$.
We may assume $S$ and $X$ are affine.
After shrinking $X$ some more we may assume that any
point of $\text{Ass}_{X_s}(\mathcal{F}_s)$ is a generalization of $x$.
This property is preserved on replacing $(S, s)$ by an elementary
\'etale neighbourhood. Hence we may apply
Lemma \ref{lemma-finite-presentation-flat-along-fibre}
to arrive at the situation where there exists a diagram
$$
\xymatrix{
X \ar[dr] & & X' \ar[ll]^g \ar[ld] \\
& S &
}
$$
of schemes affine and of finite presentation over $S$,
where $g$ is \'etale, $X_s \subset g(X')$, and with
$\Gamma(X', g^*\mathcal{F})$ a projective $\Gamma(S, \mathcal{O}_S)$-module.
Note that in this case $g^*\mathcal{F}$ is universally pure over $S$, see
Lemma \ref{lemma-affine-locally-projective-pure}.

\medskip\noindent
Let $U \subset g(X')$ be an affine open neighbourhood of $x$.
We claim that $\mathcal{F}|_U$ is pure along $U_s$. If we prove this, then
the lemma follows because $\mathcal{F}|_U$ will be pure relative to $S$
after shrinking $S$, see
Lemma \ref{lemma-flat-finite-presentation-purity-open},
whereupon the projectivity follows from
Proposition \ref{proposition-finite-presentation-flat-pure-is-projective}.
To prove the claim we have to show, after replacing $(S, s)$
by an arbitrary elementary \'etale neighbourhood, that any point $\xi$ of
$\text{Ass}_{U/S}(\mathcal{F}|_U)$ lying over some
$s' \in S$, $s' \leadsto s$ specializes to a point of $U_s$.
Since $U \subset g(X')$ we can find a $\xi' \in X'$ with
$g(\xi') = \xi$. Because $g^*\mathcal{F}$ is pure over $S$, using
Lemma \ref{lemma-associated-point-specializes},
we see there exists a specialization $\xi' \leadsto x'$ with
$x' \in \text{Ass}_{X'_s}(g^*\mathcal{F}_s)$. Then
$g(x') \in \text{Ass}_{X_s}(\mathcal{F}_s)$ (see for example
Lemma \ref{lemma-etale-weak-assassin-up-down}
applied to the \'etale morphism $X'_s \to X_s$ of Noetherian schemes)
and hence $g(x') \leadsto x$ by our choice of $X$ above! Since
$x \in U$ we conclude that $g(x') \in U$. Thus
$\xi = g(\xi') \leadsto g(x') \in U_s$ as desired.
\end{proof}

\noindent
The following lemma is an improvement of
Lemma \ref{lemma-finite-type-flat-at-point-free-variant}.

\begin{lemma}
\label{lemma-flat-finite-type-affine-neighbourhood-projective}
Let $f : X \to S$ be a morphism which is locally of finite type.
Let $\mathcal{F}$ be a quasi-coherent $\mathcal{O}_X$-module which is
of finite type. Let $x \in X$ with $s = f(x) \in S$.
If $\mathcal{F}$ is flat at $x$ over $S$ there exists an affine
elementary \'etale neighbourhood $(S', s') \to (S, s)$ and
an affine open $U' \subset X \times_S \Spec(\mathcal{O}_{S', s'})$
which contains $x' = (x, s')$ such that
$\Gamma(U', \mathcal{F}|_{U'})$ is a free
$\mathcal{O}_{S', s'}$-module.
\end{lemma}

\begin{proof}
The question is Zariski local on $X$ and $S$. Hence we may assume
that $X$ and $S$ are affine. Then we can find a closed immersion
$i : X \to \mathbf{A}^n_S$ over $S$. It is clear that it suffices to
prove the lemma for the sheaf $i_*\mathcal{F}$ on $\mathbf{A}^n_S$
and the point $i(x)$. In this way we reduce to the case where $X \to S$ is
of finite presentation. After replacing $S$ by
$\Spec(\mathcal{O}_{S', s'})$ and $X$ by an open of
$X \times_S \Spec(\mathcal{O}_{S', s'})$ we may assume that
$\mathcal{F}$ is of finite presentation, see
Proposition \ref{proposition-finite-type-flat-at-point}.
In this case we may appeal to
Lemma \ref{lemma-flat-finite-presentation-affine-neighbourhood-projective}
and
Algebra, Theorem \ref{algebra-theorem-projective-free-over-local-ring}
to conclude.
\end{proof}

\begin{lemma}
\label{lemma-flat-finite-type-local-colimit-free}
Let $A \to B$ be a local ring map of local rings which is essentially of
finite type. Let $N$ be a finite $B$-module which is flat as an $A$-module.
If $A$ is henselian, then $N$ is a filtered colimit
$$
N = \colim_i F_i
$$
of free $A$-modules $F_i$ such that all transition maps
$u_i : F_i \to F_{i'}$ of the system induce injective maps
$\overline{u}_i : F_i/\mathfrak m_AF_i \to F_{i'}/\mathfrak m_AF_{i'}$.
Also, $N$ is a Mittag-Leffler $A$-module.
\end{lemma}

\begin{proof}
We can find a morphism of finite type $X \to S = \Spec(A)$
and a point $x \in X$ lying over the closed point $s$ of $S$ and a finite
type quasi-coherent $\mathcal{O}_X$-module $\mathcal{F}$ such that
$\mathcal{F}_x \cong N$ as an $A$-module. After shrinking $X$
we may assume that each point of $\text{Ass}_{X_s}(\mathcal{F}_s)$ specializes
to $x$. By
Lemma \ref{lemma-flat-finite-type-affine-neighbourhood-projective}
we see that there exists a fundamental system of affine open neighbourhoods
$U_i \subset X$ of $x$ such that $\Gamma(U_i, \mathcal{F})$ is
a free $A$-module $F_i$. Note that if $U_{i'} \subset U_i$, then
$$
F_i/\mathfrak m_AF_i = \Gamma(U_{i, s}, \mathcal{F}_s)
\longrightarrow
\Gamma(U_{i', s}, \mathcal{F}_s) = F_{i'}/\mathfrak m_AF_{i'}
$$
is injective because a section of the kernel would be supported at
a closed subset of $X_s$ not meeting $x$ which is a contradiction
to our choice of $X$ above. Since the maps $F_i \to F_{i'}$ are
$A$-universally injective (Lemma \ref{lemma-universally-injective-local})
it follows that $N$ is
Mittag-Leffler by
Algebra, Lemma \ref{algebra-lemma-colimit-universally-injective-ML}.
\end{proof}

\noindent
The following lemma should be skipped if reading through for the first time.

\begin{lemma}
\label{lemma-flat-finite-type-local-valuation-ring-has-content}
Let $A \to B$ be a local ring map of local rings which is essentially of
finite type. Let $N$ be a finite $B$-module which is flat as an $A$-module.
If $A$ is a valuation ring, then any element of $N$ has a content ideal
$I \subset A$ (More on Algebra, Definition
\ref{more-algebra-definition-content-ideal}). Also, $I$ is a
principal ideal.
\end{lemma}

\begin{proof}
The final statement follows from the fact that $I$ is a finitely
generated ideal by
More on Algebra, Lemma \ref{more-algebra-lemma-content-finitely-generated}
and Algebra, Lemma \ref{algebra-lemma-characterize-valuation-ring}.

\medskip\noindent
Proof of existence of $I$.
Let $A \subset A^h$ be the henselization. Let $B'$ be the localization
of $B \otimes_A A^h$ at the maximal ideal
$\mathfrak m_B \otimes A^h + B \otimes \mathfrak m_{A^h}$.
Then $B \to B'$ is flat, hence faithfully flat.
Let $N' = N \otimes_B B'$.
Let $x \in N$ and let $x' \in N'$ be the image.
We claim that for an ideal $I \subset A$ we have
$x \in IN \Leftrightarrow x' \in IN'$.
Namely, $N/IN \to N'/IN'$ is the tensor product of $B \to B'$
with $N/IN$ and $B \to B'$ is universally injective by
Algebra, Lemma \ref{algebra-lemma-faithfully-flat-universally-injective}.
By More on Algebra, Lemma \ref{more-algebra-lemma-henselization-valuation-ring}
and Algebra, Lemma \ref{algebra-lemma-ideals-valuation-ring}
the map $A \to A^h$ defines an inclusion preserving
bijection $I \mapsto IA^h$ on sets of ideals. We conclude that
$x$ has a content ideal in $A$ if and only if $x'$ has a content
ideal in $A^h$. The assertion for $x' \in N'$ follows from
Lemma \ref{lemma-flat-finite-type-local-colimit-free} and
Algebra, Lemma \ref{algebra-lemma-minimal-contains}.
\end{proof}

\noindent
An application is the following.

\begin{lemma}
\label{lemma-proper-flat-over-dvr-reduced-fibre}
Let $X \to \Spec(R)$ be a proper flat morphism where $R$ is a valuation ring.
If the special fibre is reduced, then $X$ and every fibre of $X \to \Spec(R)$
is reduced.
\end{lemma}

\begin{proof}
Assume the special fibre $X_s$ is reduced.
Let $x \in X$ be any point, and let us show that $\mathcal{O}_{X, x}$
is reduced; this will prove that $X$ is reduced.
Let $x \leadsto x'$ be a specialization with $x'$
in the special fibre; such a specialization exists
as a proper morphism is closed. Consider the local
ring $A = \mathcal{O}_{X, x'}$. Then $\mathcal{O}_{X, x}$
is a localization of $A$, so it suffices to show that
$A$ is reduced. Let $a \in A$ be nonzero and let $I = (\pi) \subset R$ be its
content ideal, see
Lemma \ref{lemma-flat-finite-type-local-valuation-ring-has-content}.
Then $a = \pi a'$ and $a'$ maps to a nonzero element of
$A/\mathfrak mA$ where $\mathfrak m \subset R$ is the maximal ideal.
If $a$ is nilpotent, so is $a'$, because $\pi$ is a nonzerodivisor
by flatness of $A$ over $R$.
But $a'$ maps to a nonzero element of the reduced ring
$A/\mathfrak m A = \mathcal{O}_{X_s, x'}$.
This is a contradiction unless $A$ is reduced, which
is what we wanted to show.

\medskip\noindent
Of course, if $X$ is reduced, so is the generic fibre of $X$ over $R$.
If $\mathfrak p \subset R$ is a
prime ideal, then $R/\mathfrak p$ is a valuation ring by
Algebra, Lemma \ref{algebra-lemma-make-valuation-rings}.
Hence redoing the argument with the base change of $X$
to $R/\mathfrak p$ proves the fibre over $\mathfrak p$
is reduced.
\end{proof}






\section{Flattening functors}
\label{section-flattening-functors}

\noindent
Let $S$ be a scheme. Recall that a functor
$F : (\Sch/S)^{opp} \to \textit{Sets}$ is called limit preserving
if for every directed inverse system
$\{T_i\}_{i \in I}$ of affine schemes with limit $T$ we have
$F(T) = \colim_i F(T_i)$.

\begin{situation}
\label{situation-iso}
Let $f : X \to S$ be a morphism of schemes.
Let $u : \mathcal{F} \to \mathcal{G}$ be a homomorphism of
quasi-coherent $\mathcal{O}_X$-modules. For any scheme $T$ over
$S$ we will denote $u_T : \mathcal{F}_T \to \mathcal{G}_T$ the
base change of $u$ to $T$, in other words, $u_T$ is the pullback
of $u$ via the projection morphism $X_T = X \times_S T \to X$.
In this situation we can consider the functor
\begin{equation}
\label{equation-iso}
F_{iso} : (\Sch/S)^{opp} \longrightarrow \textit{Sets}, \quad
T \longrightarrow \left\{
\begin{matrix}
\{*\} & \text{if} & u_T \text{ is an isomorphism}, \\
\emptyset & \text{else.} &
\end{matrix}
\right.
\end{equation}
There are variants $F_{inj}$, $F_{surj}$, $F_{zero}$ where we ask that
$u_T$ is injective, surjective, or zero.
\end{situation}

\begin{lemma}
\label{lemma-iso-sheaf}
In Situation \ref{situation-iso}.
\begin{enumerate}
\item Each of the functors $F_{iso}$, $F_{inj}$, $F_{surj}$, $F_{zero}$
satisfies the sheaf property for the fpqc topology.
\item If $f$ is quasi-compact and $\mathcal{G}$ is of finite type,
then $F_{surj}$ is limit preserving.
\item If $f$ is quasi-compact and $\mathcal{F}$ of finite type, then
$F_{zero}$ is limit preserving.
\item If $f$ is quasi-compact, $\mathcal{F}$ is of finite type, and
$\mathcal{G}$ is of finite presentation, then $F_{iso}$ is limit preserving.
\end{enumerate}
\end{lemma}

\begin{proof}
Let $\{T_i \to T\}_{i \in I}$ be an fpqc covering of schemes over $S$.
Set $X_i = X_{T_i} = X \times_S T_i$ and $u_i = u_{T_i}$.
Note that $\{X_i \to X_T\}_{i \in I}$ is an fpqc covering of $X_T$, see
Topologies, Lemma \ref{topologies-lemma-fpqc}.
In particular, for every $x \in X_T$ there exists an $i \in I$
and an $x_i \in X_i$ mapping to $x$. Since
$\mathcal{O}_{X_T, x} \to \mathcal{O}_{X_i, x_i}$ is flat, hence
faithfully flat (see
Algebra, Lemma \ref{algebra-lemma-local-flat-ff})
we conclude that $(u_i)_{x_i}$ is injective, surjective, bijective, or zero
if and only if $(u_T)_x$ is injective, surjective, bijective, or zero.
Whence part (1) of the lemma.

\medskip\noindent
Proof of (2). Assume $f$ quasi-compact and $\mathcal{G}$ of finite type.
Let $T = \lim_{i \in I} T_i$ be a directed limit of affine $S$-schemes
and assume that $u_T$ is surjective.
Set $X_i = X_{T_i} = X \times_S T_i$ and
$u_i = u_{T_i} : \mathcal{F}_i = \mathcal{F}_{T_i}
\to \mathcal{G}_i = \mathcal{G}_{T_i}$.
To prove part (2) we have to show that $u_i$ is surjective for some $i$.
Pick $i_0 \in I$ and replace $I$ by $\{i \mid i \geq i_0\}$.
Since $f$ is quasi-compact the scheme $X_{i_0}$ is quasi-compact.
Hence we may choose affine opens $W_1, \ldots, W_m \subset X$
and an affine open covering
$X_{i_0} = U_{1, i_0} \cup \ldots \cup U_{m, i_0}$ such that
$U_{j, i_0}$ maps into $W_j$ under the projection morphism $X_{i_0} \to X$.
For any $i \in I$ let $U_{j, i}$ be the inverse image of $U_{j, i_0}$.
Setting $U_j = \lim_i U_{j, i}$ we see that $X_T = U_1 \cup \ldots \cup U_m$
is an affine open covering of $X_T$. Now it suffices to show, for a given
$j \in \{1, \ldots, m\}$ that $u_i|_{U_{j, i}}$ is surjective for some
$i = i(j) \in I$. Using
Properties, Lemma \ref{properties-lemma-finite-type-module}
this translates into the following algebra problem:
Let $A$ be a ring and let $u : M \to N$ be an $A$-module map.
Suppose that $R = \colim_{i \in I} R_i$ is a directed colimit
of $A$-algebras. If $N$ is a finite $A$-module and if
$u \otimes 1 : M \otimes_A R \to N \otimes_A R$ is surjective, then
for some $i$ the map
$u \otimes 1 : M \otimes_A R_i \to N \otimes_A R_i$ is surjective.
This is
Algebra, Lemma \ref{algebra-lemma-module-map-property-in-colimit} part (2).

\medskip\noindent
Proof of (3). Exactly the same arguments as given in the proof of (2)
reduces this to the following algebra problem:
Let $A$ be a ring and let $u : M \to N$ be an $A$-module map.
Suppose that $R = \colim_{i \in I} R_i$ is a directed colimit
of $A$-algebras. If $M$ is a finite $A$-module and if
$u \otimes 1 : M \otimes_A R \to N \otimes_A R$ is zero, then
for some $i$ the map
$u \otimes 1 : M \otimes_A R_i \to N \otimes_A R_i$ is zero.
This is
Algebra, Lemma \ref{algebra-lemma-module-map-property-in-colimit} part (1).

\medskip\noindent
Proof of (4).
Assume $f$ quasi-compact and $\mathcal{F}, \mathcal{G}$ of finite presentation.
Arguing in exactly the same manner as in the previous paragraph
(using in addition also
Properties, Lemma \ref{properties-lemma-finite-presentation-module})
part (3) translates into the following algebra statement:
Let $A$ be a ring and let $u : M \to N$ be an $A$-module map.
Suppose that $R = \colim_{i \in I} R_i$ is a directed colimit
of $A$-algebras. Assume $M$ is a finite $A$-module, $N$ is a finitely
presented $A$-module, and
$u \otimes 1 : M \otimes_A R \to N \otimes_A R$ is an isomorphism.
Then for some $i$ the map
$u \otimes 1 : M \otimes_A R_i \to N \otimes_A R_i$ is an isomorphism.
This is
Algebra, Lemma \ref{algebra-lemma-module-map-property-in-colimit} part (3).
\end{proof}

\begin{situation}
\label{situation-flat-at-point}
Let $(A, \mathfrak m_A)$ be a local ring.
Denote $\mathcal{C}$ the category whose objects are $A$-algebras
$A'$ which are local rings such that the algebra structure
$A \to A'$ is a local homomorphism of local rings.
A morphism between objects $A', A''$ of $\mathcal{C}$ is a
local homomorphism $A' \to A''$ of $A$-algebras.
Let $A \to B$ be a local ring map of local rings and let $M$ be a $B$-module.
If $A'$ is an object of $\mathcal{C}$ we set $B' = B \otimes_A A'$
and we set $M' = M \otimes_A A'$ as a $B'$-module.
Given $A' \in \Ob(\mathcal{C})$, consider the condition
\begin{equation}
\label{equation-flat-at-primes}
\forall \mathfrak q \in V(\mathfrak m_{A'}B' + \mathfrak m_B B')
\subset \Spec(B') :
M'_{\mathfrak q}\text{ is flat over }A'.
\end{equation}
Note the similarity with
More on Algebra, Equation (\ref{more-algebra-equation-flat-at-primes}).
In particular, if $A' \to A''$ is a morphism of $\mathcal{C}$ and
(\ref{equation-flat-at-primes}) holds for $A'$, then it holds for $A''$, see
More on Algebra,
Lemma \ref{more-algebra-lemma-base-change-flat-at-primes}.
Hence we obtain a functor
\begin{equation}
\label{equation-flat-at-point}
F_{lf} : \mathcal{C} \longrightarrow \textit{Sets}, \quad
A' \longrightarrow \left\{
\begin{matrix}
\{*\} & \text{if }(\ref{equation-flat-at-primes})\text{ holds}, \\
\emptyset & \text{else.} &
\end{matrix}
\right.
\end{equation}
\end{situation}

\begin{lemma}
\label{lemma-flat-at-point}
In Situation \ref{situation-flat-at-point}.
\begin{enumerate}
\item If $A' \to A''$ is a flat morphism in $\mathcal{C}$
then $F_{lf}(A') = F_{lf}(A'')$.
\item If $A \to B$ is essentially of finite presentation and
$M$ is a $B$-module of finite presentation, then $F_{lf}$ is limit
preserving: If $\{A_i\}_{i \in I}$ is a
directed system of objects of $\mathcal{C}$, then
$F_{lf}(\colim_i A_i) = \colim_i F_{lf}(A_i)$.
\end{enumerate}
\end{lemma}

\begin{proof}
Part (1) is a special case of
More on Algebra,
Lemma \ref{more-algebra-lemma-flat-descent-flat-at-primes}.
Part (2) is a special case of
More on Algebra,
Lemma \ref{more-algebra-lemma-limit-preserving-flat-at-primes}.
\end{proof}

\begin{lemma}
\label{lemma-flat-at-point-finite}
In Situation \ref{situation-flat-at-point}. Let $B \to C$ is a local map of
local $A$-algebras and $N$ a $C$-module. Denote
$F'_{lf} : \mathcal{C} \to \textit{Sets}$ the functor associated to the pair
$(C, N)$. If $M \cong N$ as $B$-modules and $B \to C$ is finite, then
$F_{lf} = F'_{lf}$.
\end{lemma}

\begin{proof}
Let $A'$ be an object of $\mathcal{C}$. Set $C' = C \otimes_A A'$
and $N' = N \otimes_A A'$ similarly to the definitions of $B'$, $M'$ in
Situation \ref{situation-flat-at-point}.
Note that $M' \cong N'$ as $B'$-modules.
The assumption that $B \to C$ is finite has two consequences:
(a) $\mathfrak m_C = \sqrt{\mathfrak m_B C}$ and (b)
$B' \to C'$ is finite. Consequence (a) implies that
$$
V(\mathfrak m_{A'}C' + \mathfrak m_C C')
=
\left(
\Spec(C') \to \Spec(B')
\right)^{-1}V(\mathfrak m_{A'}B' + \mathfrak m_B B').
$$
Suppose $\mathfrak q \subset V(\mathfrak m_{A'}B' + \mathfrak m_B B')$.
Then $M'_{\mathfrak q}$ is flat over $A'$ if and only if
the $C'_{\mathfrak q}$-module $N'_{\mathfrak q}$ is flat over $A'$
(because these are isomorphic as $A'$-modules) if and only if
for every maximal ideal $\mathfrak r$ of $C'_{\mathfrak q}$
the module $N'_{\mathfrak r}$ is flat over $A'$ (see
Algebra, Lemma \ref{algebra-lemma-flat-localization}).
As $B'_{\mathfrak q} \to C'_{\mathfrak q}$ is finite by (b),
the maximal ideals of $C'_{\mathfrak q}$ correspond exactly
to the primes of $C'$ lying over $\mathfrak q$ (see
Algebra, Lemma \ref{algebra-lemma-integral-going-up})
and these primes are all contained in
$V(\mathfrak m_{A'}C' + \mathfrak m_C C')$ by
the displayed equation above. Thus the result of the lemma holds.
\end{proof}

\begin{lemma}
\label{lemma-flat-at-point-go-up}
In
Situation \ref{situation-flat-at-point}
suppose that $B \to C$ is a flat local homomorphism of local
rings. Set $N = M \otimes_B C$. Denote
$F'_{lf} : \mathcal{C} \to \textit{Sets}$ the functor associated
to the pair $(C, N)$. Then $F_{lf} = F'_{lf}$.
\end{lemma}

\begin{proof}
Let $A'$ be an object of $\mathcal{C}$. Set $C' = C \otimes_A A'$
and $N' = N \otimes_A A' = M' \otimes_{B'} C'$ similarly to the definitions
of $B'$, $M'$ in
Situation \ref{situation-flat-at-point}. Note that
$$
V(\mathfrak m_{A'}B' + \mathfrak m_B B')
=
\Spec( \kappa(\mathfrak m_B) \otimes_A \kappa(\mathfrak m_{A'}) )
$$
and similarly for $V(\mathfrak m_{A'}C' + \mathfrak m_C C')$.
The ring map
$$
\kappa(\mathfrak m_B) \otimes_A \kappa(\mathfrak m_{A'})
\longrightarrow
\kappa(\mathfrak m_C) \otimes_A \kappa(\mathfrak m_{A'})
$$
is faithfully flat, hence
$V(\mathfrak m_{A'}C' + \mathfrak m_C C') \to
V(\mathfrak m_{A'}B' + \mathfrak m_B B')$ is surjective.
Finally, if $\mathfrak r \in V(\mathfrak m_{A'}C' + \mathfrak m_C C')$
maps to $\mathfrak q \in V(\mathfrak m_{A'}B' + \mathfrak m_B B')$, then
$M'_{\mathfrak q}$ is flat over $A'$ if and only if
$N'_{\mathfrak r}$ is flat over $A'$ because $B' \to C'$ is flat, see
Algebra, Lemma \ref{algebra-lemma-flatness-descends-more-general}.
The lemma follows formally from these remarks.
\end{proof}

\begin{situation}
\label{situation-free-at-generic-points}
Let $f : X \to S$ be a smooth morphism with geometrically irreducible
fibres. Let $\mathcal{F}$ be a quasi-coherent $\mathcal{O}_X$-module of
finite type. For any scheme $T$ over $S$ we will denote
$\mathcal{F}_T$ the base change of $\mathcal{F}$ to $T$, in other
words, $\mathcal{F}_T$ is the pullback of $\mathcal{F}$ via the
projection morphism $X_T = X \times_S T \to X$. Note that $X_T \to T$
is smooth with geometrically irreducible fibres, see
Morphisms, Lemma \ref{morphisms-lemma-base-change-smooth} and
More on Morphisms,
Lemma \ref{more-morphisms-lemma-base-change-fibres-geometrically-irreducible}.
Let $p \geq 0$ be an integer. Given a point $t \in T$ consider the
condition
\begin{equation}
\label{equation-free-at-generic-point-fibre}
\mathcal{F}_T \text{ is free of rank }p\text{ in a neighbourhood of }\xi_t
\end{equation}
where $\xi_t$ is the generic point of the fibre $X_t$. This condition
for all $t \in T$ is stable under base change, and hence we obtain a functor
\begin{equation}
\label{equation-free-at-generic-points}
H_p : (\Sch/S)^{opp} \longrightarrow \textit{Sets}, \quad
T \longrightarrow \left\{
\begin{matrix}
\{*\} & \text{if }\mathcal{F}_T\text{ satisfies
(\ref{equation-free-at-generic-point-fibre}) }\forall t\in T, \\
\emptyset & \text{else.}
\end{matrix}
\right.
\end{equation}
\end{situation}

\begin{lemma}
\label{lemma-free-at-generic-points}
In Situation \ref{situation-free-at-generic-points}.
\begin{enumerate}
\item The functor $H_p$ satisfies the sheaf property for the fpqc topology.
\item If $\mathcal{F}$ is of finite presentation, then functor $H_p$ is
limit preserving.
\end{enumerate}
\end{lemma}

\begin{proof}
Let $\{T_i \to T\}_{i \in I}$ be an fpqc\footnote{It is quite easy to
show that $H_p$
is a sheaf for the fppf topology using that flat morphisms of finite
presentation are open. This is all we really need later on. But it is kind
of fun to prove directly that it also satisfies the sheaf condition
for the fpqc topology.} covering of schemes over $S$.
Set $X_i = X_{T_i} = X \times_S T_i$ and denote $\mathcal{F}_i$ the
pullback of $\mathcal{F}$ to $X_i$. Assume that $\mathcal{F}_i$ satisfies
(\ref{equation-free-at-generic-point-fibre}) for all $i$.
Pick $t \in T$ and let $\xi_t \in X_T$ denote the generic point of $X_t$.
We have to show that $\mathcal{F}$ is free in a neighbourhood of $\xi_t$.
For some $i \in I$ we can find a $t_i \in T_i$ mapping to $t$.
Let $\xi_i \in X_i$ denote the generic point of $X_{t_i}$, so that
$\xi_i$ maps to $\xi_t$. The fact that $\mathcal{F}_i$ is free of rank
$p$ in a neighbourhood of $\xi_i$ implies that
$(\mathcal{F}_i)_{x_i} \cong \mathcal{O}_{X_i, x_i}^{\oplus p}$
which implies that
$\mathcal{F}_{T, \xi_t} \cong \mathcal{O}_{X_T, \xi_t}^{\oplus p}$
as $\mathcal{O}_{X_T, \xi_t} \to \mathcal{O}_{X_i, x_i}$ is flat, see
for example
Algebra, Lemma \ref{algebra-lemma-finite-projective-descends}.
Thus there exists an affine neighbourhood $U$ of $\xi_t$ in $X_T$
and a surjection
$\mathcal{O}_U^{\oplus p} \to \mathcal{F}_U = \mathcal{F}_T|_U$, see
Modules, Lemma \ref{modules-lemma-finite-type-surjective-on-stalk}.
After shrinking $T$ we may assume that $U \to T$ is surjective. Hence
$U \to T$ is a smooth morphism of affines with geometrically irreducible
fibres. Moreover, for every $t' \in T$ we see that the induced map
$$
\alpha :
\mathcal{O}_{U, \xi_{t'}}^{\oplus p}
\longrightarrow
\mathcal{F}_{U, \xi_{t'}}
$$
is an isomorphism (since by the same argument as before the module on the right
is free of rank $p$). It follows from
Lemma \ref{lemma-induction-step}
that
$$
\Gamma(U, \mathcal{O}_U^{\oplus p})
\otimes_{\Gamma(T, \mathcal{O}_T)} \mathcal{O}_{T, t'}
\longrightarrow
\Gamma(U, \mathcal{F}_U)
\otimes_{\Gamma(T, \mathcal{O}_T)} \mathcal{O}_{T, t'}
$$
is injective for every $t' \in T$. Hence we see the surjection $\alpha$ is an
isomorphism. This finishes the proof of (1).

\medskip\noindent
Assume that $\mathcal{F}$ is of finite presentation.
Let $T = \lim_{i \in I} T_i$ be a directed limit of affine $S$-schemes
and assume that $\mathcal{F}_T$ satisfies
(\ref{equation-free-at-generic-point-fibre}).
Set $X_i = X_{T_i} = X \times_S T_i$ and denote $\mathcal{F}_i$ the
pullback of $\mathcal{F}$ to $X_i$.
Let $U \subset X_T$ denote the open subscheme of points where
$\mathcal{F}_T$ is flat over $T$, see
More on Morphisms, Theorem \ref{more-morphisms-theorem-openness-flatness}.
By assumption every generic point of every fibre is a point of $U$, i.e.,
$U \to T$ is a smooth surjective morphism with geometrically irreducible
fibres. We may shrink $U$ a bit and assume that $U$ is quasi-compact.
Using
Limits, Lemma \ref{limits-lemma-descend-opens}
we can find an $i \in I$ and a quasi-compact open $U_i \subset X_i$
whose inverse image in $X_T$ is $U$. After increasing $i$ we may
assume that $\mathcal{F}_i|_{U_i}$ is flat over $T_i$, see
Limits, Lemma \ref{limits-lemma-descend-module-flat-finite-presentation}.
In particular, $\mathcal{F}_i|_{U_i}$ is finite locally free
hence defines a locally constant
rank function $\rho : U_i \to \{0, 1, 2, \ldots \}$.
Let $(U_i)_p \subset U_i$ denote the open and closed
subset where $\rho$ has value $p$. Let $V_i \subset T_i$ be the
image of $(U_i)_p$; note that $V_i$ is open and quasi-compact.
By assumption the image of $T \to T_i$ is contained in $V_i$.
Hence there exists an $i' \geq i$ such that $T_{i'} \to T_i$ factors
through $V_i$ by
Limits, Lemma \ref{limits-lemma-descend-opens}.
Then $\mathcal{F}_{i'}$ satisfies (\ref{equation-free-at-generic-point-fibre})
as desired. Some details omitted.
\end{proof}

\begin{lemma}
\label{lemma-pre-flat-dimension-n}
Let $f : X \to S$ be a morphism of schemes which is locally of finite type.
Let $\mathcal{F}$ be a quasi-coherent $\mathcal{O}_X$-module of finite
type. Let $n \geq 0$. The following are equivalent
\begin{enumerate}
\item for $s \in S$ the closed subset $Z \subset X_s$ of points
where $\mathcal{F}$ is not flat over $S$ (see
Lemma \ref{lemma-open-in-fibre-where-flat})
satisfies $\dim(Z) < n$, and
\item for $x \in X$ such that $\mathcal{F}$ is not flat at $x$
over $S$ we have $\text{trdeg}_{\kappa(f(x))}(\kappa(x)) < n$.
\end{enumerate}
If this is true, then it remains true after any base change.
\end{lemma}

\begin{proof}
Let $x \in X$ be a point over $s \in S$.
Then the dimension of the closure of $\{x\}$ in $X_s$
is $\text{trdeg}_{\kappa(s)}(\kappa(x))$ by
Varieties, Lemma \ref{varieties-lemma-dimension-locally-algebraic}.
Conversely, if $Z \subset X_s$ is a closed subset
of dimension $d$, then there exists a point $x \in Z$
with $\text{trdeg}_{\kappa(s)}(\kappa(x)) = d$ (same reference).
Therefore the equivalence of (1) and (2) holds (even fibre by fibre).
The statement on base change follows from
Morphisms, Lemmas \ref{morphisms-lemma-base-change-module-flat} and
\ref{morphisms-lemma-dimension-fibre-after-base-change}.
\end{proof}

\begin{definition}
\label{definition-flat-dimension-n}
Let $f : X \to S$ be a morphism of schemes which is locally of finite type.
Let $\mathcal{F}$ be a quasi-coherent $\mathcal{O}_X$-module of finite type.
Let $n \geq 0$.
We say {\it $\mathcal{F}$ is flat over $S$ in dimensions $\geq n$}
if the equivalent conditions of Lemma \ref{lemma-pre-flat-dimension-n}
are satisfied.
\end{definition}

\begin{situation}
\label{situation-flat-dimension-n}
Let $f : X \to S$ be a morphism of schemes which is locally of finite type.
Let $\mathcal{F}$ be a quasi-coherent $\mathcal{O}_X$-module of finite
type. For any scheme $T$ over $S$ we will denote $\mathcal{F}_T$ the
base change of $\mathcal{F}$ to $T$, in other words, $\mathcal{F}_T$
is the pullback of $\mathcal{F}$ via the projection morphism
$X_T = X \times_S T \to X$. Note that $X_T \to T$ is of finite type
and that $\mathcal{F}_T$ is an $\mathcal{O}_{X_T}$-module
of finite type (Morphisms, Lemma
\ref{morphisms-lemma-base-change-finite-type} and
Modules, Lemma \ref{modules-lemma-pullback-finite-type}).
Let $n \geq 0$. By Definition \ref{definition-flat-dimension-n} and
Lemma \ref{lemma-pre-flat-dimension-n} we obtain a functor
\begin{equation}
\label{equation-flat-dimension-n}
F_n : (\Sch/S)^{opp} \longrightarrow \textit{Sets}, \quad
T \longrightarrow \left\{
\begin{matrix}
\{*\} & \text{if }\mathcal{F}_T\text{ is flat over }T\text{ in }\dim \geq n, \\
\emptyset & \text{else.}
\end{matrix}
\right.
\end{equation}
\end{situation}

\begin{lemma}
\label{lemma-flat-dimension-n}
In Situation \ref{situation-flat-dimension-n}.
\begin{enumerate}
\item The functor $F_n$ satisfies the sheaf property for the fpqc topology.
\item If $f$ is quasi-compact and locally of finite presentation
and $\mathcal{F}$ is of finite presentation, then the functor $F_n$ is
limit preserving.
\end{enumerate}
\end{lemma}

\begin{proof}
Let $\{T_i \to T\}_{i \in I}$ be an fpqc covering of schemes over $S$.
Set $X_i = X_{T_i} = X \times_S T_i$ and denote $\mathcal{F}_i$ the
pullback of $\mathcal{F}$ to $X_i$. Assume that $\mathcal{F}_i$
is flat over $T_i$ in dimensions $\geq n$ for all $i$. Let $t \in T$.
Choose an index $i$ and a point $t_i \in T_i$ mapping to $t$.
Consider the cartesian diagram
$$
\xymatrix{
X_{\Spec(\mathcal{O}_{T, t})} \ar[d] &
X_{\Spec(\mathcal{O}_{T_i, t_i})} \ar[d] \ar[l] \\
\Spec(\mathcal{O}_{T, t}) &
\Spec(\mathcal{O}_{T_i, t_i}) \ar[l]
}
$$
As the lower horizontal morphism is flat we see from
More on Morphisms, Lemma \ref{more-morphisms-lemma-flat-locus-base-change}
that the set $Z_i \subset X_{t_i}$ where $\mathcal{F}_i$ is not flat
over $T_i$ and the set $Z \subset X_t$ where $\mathcal{F}_T$ is not flat
over $T$ are related by the rule $Z_i = Z_{\kappa(t_i)}$. Hence we see
that $\mathcal{F}_T$ is flat over $T$ in dimensions $\geq n$ by
Morphisms, Lemma \ref{morphisms-lemma-dimension-fibre-after-base-change}.

\medskip\noindent
Assume that $f$ is quasi-compact and locally of finite presentation and
that $\mathcal{F}$ is of finite presentation.
In this paragraph we first reduce the proof of (2) to the case where
$f$ is of finite presentation.
Let $T = \lim_{i \in I} T_i$ be a directed limit of
affine $S$-schemes and assume that $\mathcal{F}_T$ is flat in dimensions
$\geq n$. Set $X_i = X_{T_i} = X \times_S T_i$ and denote $\mathcal{F}_i$
the pullback of $\mathcal{F}$ to $X_i$. We have to show that
$\mathcal{F}_i$ is flat in dimensions $\geq n$ for some $i$.
Pick $i_0 \in I$ and replace $I$ by $\{i \mid i \geq i_0\}$.
Since $T_{i_0}$ is affine (hence quasi-compact) there exist finitely
many affine opens $W_j \subset S$, $j = 1, \ldots, m$ and an affine open
overing $T_{i_0} = \bigcup_{j = 1, \ldots, m} V_{j, i_0}$
such that $T_{i_0} \to S$ maps $V_{j, i_0}$ into $W_j$.
For $i \geq i_0$ denote $V_{j, i}$ the inverse image of $V_{j, i_0}$
in $T_i$. If we can show, for each $j$, that there exists an $i$ such that
$\mathcal{F}_{V_{j, i_0}}$ is flat in dimensions $\geq n$, then
we win. In this way we reduce to the case that $S$ is affine.
In this case $X$ is quasi-compact and we can choose a finite
affine open covering $X = W_1 \cup \ldots \cup W_m$. In this case
the result for $(X \to S, \mathcal{F})$ is equivalent to the result for
$(\coprod W_j, \coprod \mathcal{F}|_{W_j})$. Hence we may assume that
$f$ is of finite presentation.

\medskip\noindent
Assume $f$ is of finite presentation and $\mathcal{F}$ is of finite
presentation. Let $U \subset X_T$ denote the open subscheme of points where
$\mathcal{F}_T$ is flat over $T$, see
More on Morphisms, Theorem \ref{more-morphisms-theorem-openness-flatness}.
By assumption the dimension of every fibre of $Z = X_T \setminus U$ over
$T$ has dimension $< n$. By
Limits, Lemma \ref{limits-lemma-approximate-given-relative-dimension}
we can find a closed subscheme $Z \subset Z' \subset X_T$
such that $\dim(Z'_t) < n$ for all $t \in T$ and such that
$Z' \to X_T$ is of finite presentation. By
Limits, Lemmas \ref{limits-lemma-descend-finite-presentation} and
\ref{limits-lemma-descend-closed-immersion-finite-presentation}
there exists an $i \in I$ and a closed subscheme $Z'_i \subset X_i$
of finite presentation whose base change to $T$ is $Z'$. By
Limits, Lemma \ref{limits-lemma-limit-dimension}
we may assume all fibres of $Z'_i \to T_i$ have dimension $< n$. By
Limits, Lemma \ref{limits-lemma-descend-module-flat-finite-presentation}
we may assume that $\mathcal{F}_i|_{X_i \setminus T'_i}$
is flat over $T_i$. This implies that $\mathcal{F}_i$ is
flat in dimensions $\geq n$; here we use that $Z' \to X_T$ is of finite
presentation, and hence the complement $X_T \setminus Z'$ is quasi-compact!
Thus part (2) is proved and the proof of the lemma is complete.
\end{proof}

\begin{situation}
\label{situation-flat}
Let $f : X \to S$ be a morphism of schemes.
Let $\mathcal{F}$ be a quasi-coherent $\mathcal{O}_X$-module.
For any scheme $T$ over $S$ we will denote $\mathcal{F}_T$ the
base change of $\mathcal{F}$ to $T$, in other words, $\mathcal{F}_T$
is the pullback of $\mathcal{F}$ via the projection morphism
$X_T = X \times_S T \to X$. Since the base change of a flat module
is flat we obtain a functor
\begin{equation}
\label{equation-flat}
F_{flat} : (\Sch/S)^{opp} \longrightarrow \textit{Sets}, \quad
T \longrightarrow \left\{
\begin{matrix}
\{*\} & \text{if } \mathcal{F}_T \text{ is flat over }T, \\
\emptyset & \text{else.}
\end{matrix}
\right.
\end{equation}
\end{situation}

\begin{lemma}
\label{lemma-flat}
In Situation \ref{situation-flat}.
\begin{enumerate}
\item The functor $F_{flat}$ satisfies the sheaf property for the fpqc topology.
\item If $f$ is quasi-compact and locally of finite presentation
and $\mathcal{F}$ is of finite presentation, then the functor
$F_{flat}$ is limit preserving.
\end{enumerate}
\end{lemma}

\begin{proof}
Part (1) follows from the following statement: If $T' \to T$ is a surjective
flat morphism of schemes over $S$, then $\mathcal{F}_{T'}$ is flat over $T'$
if and only if $\mathcal{F}_T$ is flat over $T$, see
More on Morphisms, Lemma \ref{more-morphisms-lemma-flat-locus-base-change}.
Part (2) follows from
Limits, Lemma \ref{limits-lemma-descend-module-flat-finite-presentation}
after reducing to the case where $X$ and $S$ are affine (compare with
the proof of
Lemma \ref{lemma-flat-dimension-n}).
\end{proof}




\section{Flattening stratifications}
\label{section-flattening}

\noindent
Just the definitions. The reader looking for a
``generic flatness stratification'', should consult
More on Morphisms, Section
\ref{more-morphisms-section-generic-flatness-stratification}.

\begin{definition}
\label{definition-flattening}
Let $X \to S$ be a morphism of schemes.
Let $\mathcal{F}$ be a quasi-coherent $\mathcal{O}_X$-module.
We say that the {\it universal flattening of $\mathcal{F}$ exists}
if the functor $F_{flat}$ defined in Situation \ref{situation-flat}
is representable by a scheme $S'$ over $S$.
We say that the {\it universal flattening of $X$ exists}
if the universal flattening of $\mathcal{O}_X$ exists.
\end{definition}

\noindent
Note that if the universal flattening $S'$\footnote{The scheme $S'$ is sometimes
called the {\it universal flatificator}. In \cite{GruRay} it is called
the {\it platificateur universel}. Existence of the universal flattening
should not be confused with the type of results discussed in
More on Algebra, Section \ref{more-algebra-section-blowup-flat}.} of
$\mathcal{F}$ exists, then the morphism $S' \to S$ is a surjective
monomorphism of schemes such that $\mathcal{F}_{S'}$ is flat over $S'$
and such that a morphism $T \to S$ factors through $S'$ if and only if
$\mathcal{F}_T$ is flat over $T$.

\begin{example}
\label{example-no-universal-flattening}
Let $X = S = \Spec(k[x, y])$ where $k$ is a field. Let
$\mathcal{F} = \widetilde{M}$ where $M = k[x, x^{-1}, y]/(y)$.
For a $k[x, y]$-algebra $A$ set $F_{flat}(A) = F_{flat}(\Spec(A))$.
Then $F_{flat}(k[x, y]/(x, y)^n) = \{*\}$ for all $n$, while
$F_{flat}(k[[x, y]]) = \emptyset$. This means that $F_{flat}$ isn't
representable (even by an algebraic space, see
Formal Spaces, Lemma
\ref{formal-spaces-lemma-map-into-algebraic-space}).
Thus the universal flattening does not exist in this case.
\end{example}

\noindent
We define (compare with
Topology, Remark \ref{topology-remark-locally-finite-stratification})
a (locally finite, scheme theoretic) {\it stratification} of a scheme $S$
to be given by closed subschemes $Z_i \subset S$ indexed by a
partially ordered set $I$ such that
$S = \bigcup Z_i$ (set theoretically), such that every point of $S$ has
a neighbourhood meeting only a finite number of $Z_i$, and such that
$$
Z_i \cap Z_j = \bigcup\nolimits_{k \leq i, j} Z_k.
$$
Setting $S_i = Z_i \setminus \bigcup_{j < i} Z_j$ the actual
stratification is the decomposition $S = \coprod S_i$ into
locally closed subschemes. We often only indicate the strata
$S_i$ and leave the construction of the closed subschemes $Z_i$
to the reader. Given a stratification we obtain a monomorphism
$$
S' = \coprod\nolimits_{i \in I} S_i \longrightarrow S.
$$
We will call this the {\it monomorphism associated to the stratification}.
With this terminology we can define what it means to have a flattening
stratification.

\begin{definition}
\label{definition-flattening-stratification}
Let $X \to S$ be a morphism of schemes.
Let $\mathcal{F}$ be a quasi-coherent $\mathcal{O}_X$-module.
We say that $\mathcal{F}$ has a {\it flattening stratification}
if the functor $F_{flat}$ defined in Situation \ref{situation-flat}
is representable by a monomorphism $S' \to S$ associated
to a stratification of $S$ by locally closed subschemes.
We say that $X$ has a {\it flattening stratification}
if $\mathcal{O}_X$ has a flattening stratification.
\end{definition}

\noindent
When a flattening stratification exists, it is often important
to understand the index set labeling the strata and its partial ordering.
This often has to do with ranks of modules. For example if
$X = S$ and $\mathcal{F}$ is a finitely presented $\mathcal{O}_S$-module,
then the flattening stratification exists and is given by the Fitting ideals
of $\mathcal{F}$, see
Divisors, Lemma \ref{divisors-lemma-finite-presentation-module}.




\section{Flattening stratification over an Artinian ring}
\label{section-flattening-artinian}

\noindent
A flatting stratification exists when the base scheme is the spectrum
of an Artinian ring.

\begin{lemma}
\label{lemma-flattening-stratification-artinian}
Let $S$ be the spectrum of an Artinian ring.
For any scheme $X$ over $S$, and any quasi-coherent $\mathcal{O}_X$-module
there exists a universal flattening. In fact the universal flattening
is given by a closed immersion $S' \to S$, and hence is a flattening
stratification for $\mathcal{F}$ as well.
\end{lemma}

\begin{proof}
Choose an affine open covering $X = \bigcup U_i$.
Then $F_{flat}$ is the product of the functors associated to
each of the pairs $(U_i, \mathcal{F}|_{U_i})$.
Hence it suffices to prove the result for each
$(U_i, \mathcal{F}|_{U_i})$.
In the affine case the lemma follows immediately from
More on Algebra,
Lemma \ref{more-algebra-lemma-flattening-artinian-universal-property}.
\end{proof}






\section{Flattening a map}
\label{section-flattening-map}

\noindent
Theorem \ref{theorem-flattening-map}
is the key to further flattening statements.

\begin{lemma}
\label{lemma-universally-separating}
Let $S$ be a scheme.
Let $g : X' \to X$ be a flat morphism of schemes over $S$
with $X$ locally of finite type over $S$.
Let $\mathcal{F}$ be a finite type quasi-coherent $\mathcal{O}_X$-module
which is flat over $S$. If $\text{Ass}_{X/S}(\mathcal{F}) \subset g(X')$
then the canonical map
$$
\mathcal{F} \longrightarrow g_*g^*\mathcal{F}
$$
is injective, and remains injective after any base change.
\end{lemma}

\begin{proof}
The final assertion means that $\mathcal{F}_T \to (g_T)_*g_T^*\mathcal{F}_T$
is injective for any morphism $T \to S$. The assumption
$\text{Ass}_{X/S}(\mathcal{F}) \subset g(X')$ is preserved by base change, see
Divisors, Lemma \ref{divisors-lemma-base-change-relative-assassin} and
Remark \ref{divisors-remark-base-change-relative-assassin}.
The same holds for the assumption of flatness and finite type.
Hence it suffices to prove the injectivity of the displayed arrow.
Let $\mathcal{K} = \Ker(\mathcal{F} \to g_*g^*\mathcal{F})$.
Our goal is to prove that $\mathcal{K} = 0$.
In order to do this it suffices to prove that
$\text{WeakAss}_X(\mathcal{K}) = \emptyset$, see
Divisors, Lemma \ref{divisors-lemma-weakly-ass-zero}.
We have
$\text{WeakAss}_X(\mathcal{K}) \subset \text{WeakAss}_X(\mathcal{F})$, see
Divisors, Lemma \ref{divisors-lemma-ses-weakly-ass}.
As $\mathcal{F}$ is flat we see from
Lemma \ref{lemma-bourbaki-finite-type-general-base}
that $\text{WeakAss}_X(\mathcal{F}) \subset \text{Ass}_{X/S}(\mathcal{F})$.
By assumption any point $x$ of $\text{Ass}_{X/S}(\mathcal{F})$
is the image of some $x' \in X'$. Since $g$ is flat the
local ring map $\mathcal{O}_{X, x} \to \mathcal{O}_{X', x'}$
is faithfully flat, hence the map
$$
\mathcal{F}_x
\longrightarrow
g^*\mathcal{F}_{x'} =
\mathcal{F}_x \otimes_{\mathcal{O}_{X, x}} \mathcal{O}_{X', x'}
$$
is injective (see
Algebra, Lemma \ref{algebra-lemma-faithfully-flat-universally-injective}).
This implies that $\mathcal{K}_x = 0$ as desired.
\end{proof}

\begin{lemma}
\label{lemma-flattening-module-map}
Let $A$ be a ring. Let $u : M \to N$ be a surjective map of $A$-modules.
If $M$ is projective as an $A$-module, then there exists an ideal
$I \subset A$ such that for any ring map $\varphi : A \to B$
the following are equivalent
\begin{enumerate}
\item $u \otimes 1 : M \otimes_A B \to N \otimes_A B$ is an
isomorphism, and
\item $\varphi(I) = 0$.
\end{enumerate}
\end{lemma}

\begin{proof}
As $M$ is projective we can find a projective $A$-module $C$
such that $F = M \oplus C$ is a free $A$-module.
By replacing $u$ by $u \oplus 1 : F = M \oplus C \to N \oplus C$
we see that we may assume $M$ is free. In this case let $I$ be
the ideal of $A$ generated by coefficients of all the elements of
$\Ker(u)$ with respect to some (fixed) basis of $M$.
The reason this works is that, since $u$ is surjective and
$\otimes_A B$ is right exact, $\Ker(u \otimes 1)$ is
the image of $\Ker(u) \otimes_A B$ in $M \otimes_A B$.
\end{proof}

\begin{theorem}
\label{theorem-flattening-map}
In
Situation \ref{situation-iso}
assume
\begin{enumerate}
\item $f$ is of finite presentation,
\item $\mathcal{F}$ is of finite presentation, flat over $S$, and
pure relative to $S$, and
\item $u$ is surjective.
\end{enumerate}
Then $F_{iso}$ is representable by a closed immersion $Z \to S$.
Moreover $Z \to S$ is of finite presentation if $\mathcal{G}$ is
of finite presentation.
\end{theorem}

\begin{proof}
We will use without further mention that $\mathcal{F}$ is universally pure
over $S$, see
Lemma \ref{lemma-finite-type-flat-pure-along-fibre-is-universal}.
By
Lemma \ref{lemma-iso-sheaf}
and
Descent, Lemmas \ref{descent-lemma-closed-immersion} and
\ref{descent-lemma-descent-data-sheaves}
the question is local for the \'etale topology on $S$.
Hence it suffices to prove, given $s \in S$, that there exists
an \'etale neighbourhood of $(S, s)$ so that the theorem holds.

\medskip\noindent
Using
Lemma \ref{lemma-finite-presentation-flat-along-fibre}
and after replacing $S$ by an elementary \'etale neighbourhood of $s$
we may assume there exists a commutative diagram
$$
\xymatrix{
X \ar[dr] & & X' \ar[ll]^g \ar[ld] \\
& S &
}
$$
of schemes of finite presentation over $S$,
where $g$ is \'etale, $X_s \subset g(X')$, the schemes $X'$ and $S$ are affine,
$\Gamma(X', g^*\mathcal{F})$ a projective $\Gamma(S, \mathcal{O}_S)$-module.
Note that $g^*\mathcal{F}$ is universally pure over $S$, see
Lemma \ref{lemma-affine-locally-projective-pure}.
Hence by
Lemma \ref{lemma-criterion}
we see that the open $g(X')$ contains the points of
$\text{Ass}_{X/S}(\mathcal{F})$ lying over $\Spec(\mathcal{O}_{S, s})$.
Set
$$
E = \{t \in S \mid \text{Ass}_{X_t}(\mathcal{F}_t) \subset g(X') \}.
$$
By
More on Morphisms,
Lemma \ref{more-morphisms-lemma-relative-assassin-constructible}
$E$ is a constructible subset of $S$. We have seen that
$\Spec(\mathcal{O}_{S, s}) \subset E$. By
Morphisms, Lemma \ref{morphisms-lemma-constructible-containing-open}
we see that $E$ contains an open neighbourhood of $s$. Hence after
replacing $S$ by a smaller affine neighbourhood of $s$ we may assume that
$\text{Ass}_{X/S}(\mathcal{F}) \subset g(X')$.

\medskip\noindent
Since we have assumed that $u$ is surjective we have $F_{iso} = F_{inj}$. From
Lemma \ref{lemma-universally-separating}
it follows that $u : \mathcal{F} \to \mathcal{G}$ is injective if and only if
$g^*u : g^*\mathcal{F} \to g^*\mathcal{G}$ is injective, and the same remains
true after any base change. Hence we have reduced to the case where,
in addition to the assumptions in the theorem, $X \to S$ is a morphism of
affine schemes and $\Gamma(X, \mathcal{F})$ is a projective
$\Gamma(S, \mathcal{O}_S)$-module. This case follows immediately from
Lemma \ref{lemma-flattening-module-map}.

\medskip\noindent
To see that $Z$ is of finite presentation if $\mathcal{G}$ is of finite
presentation, combine
Lemma \ref{lemma-iso-sheaf} part (4)
with
Limits, Remark \ref{limits-remark-limit-preserving}.
\end{proof}

\begin{lemma}
\label{lemma-Weil-restriction-closed-subschemes}
Let $f:X\to S$ be a morphism of schemes which is of finite presentation,
flat, and pure. Let $Y$ be a closed subscheme of $X$. Let $F=f_*Y$ be the
Weil restriction functor of $Y$ along $f$, defined by
$$
F : (\Sch/S)^{opp} \to \textit{Sets}, \quad
T \mapsto
\left\{
\begin{matrix}
\{*\} & \text{if} & Y_T\to X_T \text{ is an isomorphism, }\\
\emptyset & \text{else.} &
\end{matrix}
\right.
$$
Then $F$ is representable by a closed immersion $Z\to S$. Moreover
$Z\to S$ is of finite presentation if $Y\to S$ is.
\end{lemma}

\begin{proof}
Let $\mathcal{I}$ be the ideal sheaf defining $Y$ in $X$ and let
$u:\mathcal{O}_X\to\mathcal{O}_X/\mathcal{I}$ be the surjection.
Then for an $S$-scheme $T$, the closed immersion $Y_T\to X_T$
is an isomorphism if and only if $u_T$ is an isomorphism. Hence
the result follows from
Theorem \ref{theorem-flattening-map}.
\end{proof}



\section{Flattening in the local case}
\label{section-flattening-local}

\noindent
In this section we start applying the earlier material to obtain a
shadow of the flattening stratification.

\begin{theorem}
\label{theorem-flattening-local}
In
Situation \ref{situation-flat-at-point}
assume $A$ is henselian, $B$ is essentially of finite type over $A$, and
$M$ is a finite $B$-module. Then there exists an ideal
$I \subset A$ such that $A/I$ corepresents the functor $F_{lf}$ on the category
$\mathcal{C}$. In other words given a local homomorphism of local rings
$\varphi : A \to A'$ with $B' = B \otimes_A A'$ and $M' = M \otimes_A A'$
the following are equivalent:
\begin{enumerate}
\item $\forall \mathfrak q \in V(\mathfrak m_{A'}B' + \mathfrak m_B B')
\subset \Spec(B') :
M'_{\mathfrak q}\text{ is flat over }A'$, and
\item $\varphi(I) = 0$.
\end{enumerate}
If $B$ is essentially of finite presentation over $A$ and $M$
of finite presentation over $B$, then $I$ is a finitely generated ideal.
\end{theorem}

\begin{proof}
Choose a finite type ring map $A \to C$ and a finite $C$-module $N$
and a prime $\mathfrak q$ of $C$ such that $B = C_{\mathfrak q}$
and $M = N_{\mathfrak q}$. In the following, when we say
``the theorem holds for $(N/C/A, \mathfrak q)$ we mean that
it holds for $(A \to B, M)$ where $B = C_{\mathfrak q}$ and
$M = N_{\mathfrak q}$. By
Lemma \ref{lemma-flat-at-point-go-up}
the functor $F_{lf}$ is unchanged if we replace $B$ by a local ring
flat over $B$. Hence, since $A$ is henselian, we may apply
Lemma \ref{lemma-existence-algebra}
and assume that there exists a complete d\'evissage of
$N/C/A$ at $\mathfrak q$.

\medskip\noindent
Let $(A_i, B_i, M_i, \alpha_i, \mathfrak q_i)_{i = 1, \ldots, n}$
be such a complete d\'evissage of $N/C/A$ at $\mathfrak q$. Let
$\mathfrak q'_i \subset A_i$ be the unique prime lying over
$\mathfrak q_i \subset B_i$ as in
Definition \ref{definition-complete-devissage-at-x-algebra}.
Since $C \to A_1$ is surjective and $N \cong M_1$ as $C$-modules,
we see by
Lemma \ref{lemma-flat-at-point-finite}
it suffices to prove the theorem holds for $(M_1/A_1/A, \mathfrak q'_1)$.
Since $B_1 \to A_1$ is finite and $\mathfrak q_1$ is the only prime
of $B_1$ over $\mathfrak q'_1$ we see that
$(A_1)_{\mathfrak q'_1} \to (B_1)_{\mathfrak q_1}$ is finite (see
Algebra, Lemma \ref{algebra-lemma-unique-prime-over-localize-below} or
More on Morphisms,
Lemma \ref{more-morphisms-lemma-finite-morphism-single-point-in-fibre}).
Hence by
Lemma \ref{lemma-flat-at-point-finite}
it suffices to prove the theorem holds for $(M_1/B_1/A, \mathfrak q_1)$.

\medskip\noindent
At this point we may assume, by induction on the length $n$ of the
d\'evissage, that the theorem holds for $(M_2/B_2/A, \mathfrak q_2)$.
(If $n = 1$, then $M_2 = 0$ which is flat over $A$.)
Reversing the last couple of steps of the previous paragraph, using
that $M_2 \cong \Coker(\alpha_2)$ as $B_1$-modules, we see
that the theorem holds for $(\Coker(\alpha_1)/B_1/A, \mathfrak q_1)$.

\medskip\noindent
Let $A'$ be an object of $\mathcal{C}$. At this point we use
Lemma \ref{lemma-induction-step}
to see that if $(M_1 \otimes_A A')_{\mathfrak q'}$ is flat
over $A'$ for a prime $\mathfrak q'$ of $B_1 \otimes_A A'$
lying over $\mathfrak m_{A'}$, then
$(\Coker(\alpha_1) \otimes_A A')_{\mathfrak q'}$ is flat over $A'$.
Hence we conclude that $F_{lf}$ is a subfunctor of the
functor $F'_{lf}$ associated to the module
$\Coker(\alpha_1)_{\mathfrak q_1}$ over $(B_1)_{\mathfrak q_1}$.
By the previous paragraph we know $F'_{lf}$ is corepresented by
$A/J$ for some ideal $J \subset A$. Hence we may replace $A$ by
$A/J$ and assume that $\Coker(\alpha_1)_{\mathfrak q_1}$ is
flat over $A$.

\medskip\noindent
Since $\Coker(\alpha_1)$ is a $B_1$-module for which
there exist a complete d\'evissage of $N_1/B_1/A$ at $\mathfrak q_1$
and since $\Coker(\alpha_1)_{\mathfrak q_1}$ is
flat over $A$ by
Lemma \ref{lemma-complete-devissage-flat-finite-type-module}
we see that $\Coker(\alpha_1)$ is free as an $A$-module, in particular
flat as an $A$-module. Hence
Lemma \ref{lemma-induction-step}
implies $F_{lf}(A')$ is nonempty if and only if $\alpha \otimes 1_{A'}$
is injective. Let $N_1 = \Im(\alpha_1) \subset M_1$ so that
we have exact sequences
$$
0 \to N_1 \to M_1 \to \Coker(\alpha_1) \to 0
\quad\text{and}\quad
B_1^{\oplus r_1} \to N_1 \to 0
$$
The flatness of $\Coker(\alpha_1)$ implies the first sequence
is universally exact (see
Algebra, Lemma \ref{algebra-lemma-flat-universally-injective}).
Hence $\alpha \otimes 1_{A'}$ is injective if and only if
$B_1^{\oplus r_1} \otimes_A A' \to N_1 \otimes_A A'$
is an isomorphism. Finally,
Theorem \ref{theorem-flattening-map}
applies to show this functor is corepresentable by $A/I$ for some ideal $I$
and we conclude $F_{lf}$ is corepresentable by $A/I$ also.

\medskip\noindent
To prove the final statement, suppose that $A \to B$ is essentially of finite
presentation and $M$ of finite presentation over $B$. Let $I \subset A$
be the ideal such that $F_{lf}$ is corepresented by $A/I$.
Write $I = \bigcup I_\lambda$ where $I_\lambda$ ranges over the finitely
generated ideals contained in $I$. Then, since $F_{lf}(A/I) = \{*\}$
we see that $F_{lf}(A/I_\lambda) = \{*\}$ for some $\lambda$, see
Lemma \ref{lemma-flat-at-point} part (2).
Clearly this implies that $I = I_\lambda$.
\end{proof}

\begin{remark}
\label{remark-flattening-local-scheme-theoretic}
Here is a scheme theoretic reformulation of
Theorem \ref{theorem-flattening-local}.
Let $(X, x) \to (S, s)$ be a morphism of pointed schemes
which is locally of finite type. Let $\mathcal{F}$ be a finite
type quasi-coherent $\mathcal{O}_X$-module.
Assume $S$ henselian local with closed point $s$.
There exists a closed subscheme $Z \subset S$ with the following property:
for any morphism of pointed schemes $(T, t) \to (S, s)$ the following
are equivalent
\begin{enumerate}
\item $\mathcal{F}_T$ is flat over $T$ at all points of the fibre
$X_t$ which map to $x \in X_s$, and
\item $\Spec(\mathcal{O}_{T, t}) \to S$ factors through $Z$.
\end{enumerate}
Moreover, if $X \to S$ is of finite presentation at $x$ and $\mathcal{F}_x$
of finite presentation over $\mathcal{O}_{X, x}$, then $Z \to S$
is of finite presentation.
\end{remark}

\noindent
At this point we can obtain some very general results completely
for free from the result above. Note that perhaps the most interesting
case is when $E = X_s$!

\begin{lemma}
\label{lemma-freebie}
Let $S$ be the spectrum of a henselian local ring with closed point $s$.
Let $X \to S$ be a morphism of schemes which is locally of finite type.
Let $\mathcal{F}$ be a finite type quasi-coherent $\mathcal{O}_X$-module.
Let $E \subset X_s$ be a subset. There exists a closed subscheme
$Z \subset S$ with the following property: for any morphism of pointed
schemes $(T, t) \to (S, s)$ the following are equivalent
\begin{enumerate}
\item $\mathcal{F}_T$ is flat over $T$ at all points of the fibre
$X_t$ which map to a point of $E \subset X_s$, and
\item $\Spec(\mathcal{O}_{T, t}) \to S$ factors through $Z$.
\end{enumerate}
Moreover, if $X \to S$ is locally of finite presentation,
$\mathcal{F}$ is of finite presentation, and $E \subset X_s$ is
closed and quasi-compact, then $Z \to S$ is of finite presentation.
\end{lemma}

\begin{proof}
For $x \in X_s$ denote $Z_x \subset S$ the closed subscheme we found in
Remark \ref{remark-flattening-local-scheme-theoretic}.
Then it is clear that $Z = \bigcap_{x \in E} Z_x$ works!

\medskip\noindent
To prove the final statement assume $X$ locally of finite presentation,
$\mathcal{F}$ of finite presentation and $Z$ closed and quasi-compact.
First, choose finitely many affine opens $W_j \subset X$ such that
$E \subset \bigcup W_j$. It clearly suffices to prove the
result for each morphism $W_j \to S$ with sheaf $\mathcal{F}|_{X_j}$
and closed subset $E \cap W_j$. Hence we may assume $X$ is affine.
In this case,
More on Algebra, Lemma \ref{more-algebra-lemma-limit-preserving-flat-at-primes}
shows that the functor defined by (1) is ``limit preserving''.
Hence we can show that $Z \to S$ is of finite presentation exactly
as in the last part of the proof of
Theorem \ref{theorem-flattening-local}.
\end{proof}

\begin{remark}
\label{remark-flattening-complete-noetherian}
Tracing the proof of
Lemma \ref{lemma-freebie}
to its origins we find a long and winding road. But if we assume that
\begin{enumerate}
\item $f$ is of finite type,
\item $\mathcal{F}$ is a finite type $\mathcal{O}_X$-module,
\item $E = X_s$, and
\item $S$ is the spectrum of a Noetherian complete local ring.
\end{enumerate}
then there is a proof relying completely on more elementary algebra as
follows: first we reduce to the case where $X$ is affine by taking
a finite affine open cover. In this case $Z$ exists by
More on Algebra,
Lemma \ref{more-algebra-lemma-flattening-complete-local-universal-property}.
The key step in this proof is constructing the closed subscheme $Z$
step by step inside the truncations
$\Spec(\mathcal{O}_{S, s}/\mathfrak m_s^n)$.
This relies on the fact that flattening stratifications always exist
when the base is Artinian, and the fact that
$\mathcal{O}_{S, s} = \lim \mathcal{O}_{S, s}/\mathfrak m_s^n$.
\end{remark}




\section{Variants of a lemma}
\label{section-variants-mod-injective}

\noindent
In this section we discuss variants of
Algebra, Lemmas \ref{algebra-lemma-mod-injective-general} and
\ref{algebra-lemma-mod-injective}.
The most general version is
Proposition \ref{proposition-finite-type-injective-into-flat-mod-m};
this was stated as \cite[Lemma 4.2.2]{GruRay} but the proof in
loc.cit.\ only gives the weaker result as stated in
Lemma \ref{lemma-upstairs-finite-type-injective-into-flat-mod-m}.
The intricate proof of
Proposition \ref{proposition-finite-type-injective-into-flat-mod-m}
is due to Ofer Gabber. As we currently have no application for
the proposition we encourage the reader to skip to the next section
after reading the proof of
Lemma \ref{lemma-upstairs-finite-type-injective-into-flat-mod-m};
this lemma will be used in the next section to prove
Theorem \ref{theorem-check-flatness-at-associated-points}.

\begin{situation}
\label{situation-mod-injective}
Let $\varphi : A \to B$ be a local ring homomorphism of local rings
which is essentially of finite type. Let $M$ be a flat $A$-module,
$N$ a finite $B$-module and $u : N \to M$ an $A$-module map such that
$\overline{u} : N/\mathfrak m_AN \to M/\mathfrak m_AM$ is injective.
\end{situation}

\noindent
In this situation it is our goal to show that $u$ is $A$-universally injective,
$N$ is of finite presentation over $B$, and $N$ is flat as an $A$-module.
If this is true, we will say {\it the lemma holds} in the given situation.

\begin{lemma}
\label{lemma-Noetherian-finite-type-injective-into-flat-mod-m}
If in Situation \ref{situation-mod-injective} the ring $A$ is Noetherian
then the lemma holds.
\end{lemma}

\begin{proof}
Applying Algebra, Lemma \ref{algebra-lemma-mod-injective} we see that
$u$ is injective and that $N/u(M)$ is flat over $A$. Then $u$ is
$A$-universally injective
(Algebra, Lemma \ref{algebra-lemma-flat-tor-zero}) and $N$ is $A$-flat
(Algebra, Lemma \ref{algebra-lemma-flat-ses}). Since $B$ is Noetherian
in this case we see that $N$ is of finite presentation.
\end{proof}

\begin{lemma}
\label{lemma-reduce-finite-type-injective-into-flat-mod-m}
Let $A_0$ be a local ring. If the lemma holds for every
Situation \ref{situation-mod-injective} with $A = A_0$, with $B$ a
localization of a polynomial algebra over $A$, and $N$ of finite presentation
over $B$, then the lemma holds for every
Situation \ref{situation-mod-injective} with $A = A_0$.
\end{lemma}

\begin{proof}
Let $A \to B$, $u : N \to M$ be as in Situation \ref{situation-mod-injective}.
Write $B = C/I$ where $C$ is the localization of a polynomial algebra
over $A$ at a prime. If we can show that $N$ is finitely presented as
a $C$-module, then a fortiori this shows that $N$ is finitely presented
as a $B$-module (see
Algebra, Lemma \ref{algebra-lemma-finitely-presented-over-subring}).
Hence we may assume that $B$ is the localization of a polynomial algebra.
Next, write $N = B^{\oplus n}/K$ for some submodule $K \subset B^{\oplus n}$.
Since $B/\mathfrak m_AB$ is Noetherian (as it is essentially of finite type
over a field), there exist finitely many elements $k_1, \ldots, k_s \in K$
such that for $K' = \sum Bk_i$ and $N' = B^{\oplus n}/K'$ the
canonical surjection $N' \to N$ induces an isomorphism
$N'/\mathfrak m_AN' \cong N/\mathfrak m_AN$.
Now, if the lemma holds for the composition $u' : N' \to M$,
then $u'$ is injective, hence $N' = N$ and $u' = u$. Thus the lemma holds for
the original situation.
\end{proof}

\begin{lemma}
\label{lemma-henselian-finite-type-injective-into-flat-mod-m}
If in Situation \ref{situation-mod-injective} the ring $A$ is henselian
then the lemma holds.
\end{lemma}

\begin{proof}
It suffices to prove this when $B$ is essentially of finite presentation
over $A$ and $N$ is of finite presentation over $B$, see
Lemma \ref{lemma-reduce-finite-type-injective-into-flat-mod-m}.
Let us temporarily make the additional assumption that $N$ is flat over $A$.
Then $N$ is a filtered colimit $N = \colim_i F_i$
of free $A$-modules $F_i$ such that the transition maps
$u_{ii'} : F_i \to F_{i'}$ are injective modulo $\mathfrak m_A$, see
Lemma \ref{lemma-flat-finite-type-local-colimit-free}.
Each of the compositions $u_i : F_i \to M$ is $A$-universally
injective by
Lemma \ref{lemma-universally-injective-local}
wherefore $u = \colim u_i$ is $A$-universally injective as desired.

\medskip\noindent
Assume $A$ is a henselian local ring, $B$ is essentially
of finite presentation over $A$, $N$ of finite presentation over $B$. By
Theorem \ref{theorem-flattening-local}
there exists a finitely generated ideal $I \subset A$ such that
$N/IN$ is flat over $A/I$ and such that $N/I^2N$ is not flat over
$A/I^2$ unless $I = 0$. The result of the previous paragraph shows that
the lemma holds for $u \bmod I : N/IN \to M/IM$ over $A/I$.
Consider the commutative diagram
$$
\xymatrix{
0 \ar[r] &
M \otimes_A I/I^2 \ar[r] &
M/I^2M \ar[r] &
M/IM \ar[r] & 0 \\
&
N \otimes_A I/I^2 \ar[r] \ar[u]^u &
N/I^2N \ar[r] \ar[u]^u &
N/IN \ar[r] \ar[u]^u & 0
}
$$
whose rows are exact by right exactness of $\otimes$ and the fact that
$M$ is flat over $A$. Note that the left vertical arrow is the map
$N/IN \otimes_{A/I} I/I^2 \to M/IM \otimes_{A/I} I/I^2$, hence is
injective. A diagram chase shows that the lower left arrow is injective,
i.e., $\text{Tor}^1_{A/I^2}(I/I^2, M/I^2) = 0$ see
Algebra, Remark \ref{algebra-remark-Tor-ring-mod-ideal}.
Hence $N/I^2N$ is flat over $A/I^2$ by
Algebra, Lemma \ref{algebra-lemma-what-does-it-mean}
a contradiction unless $I = 0$.
\end{proof}

\noindent
The following lemma discusses the special case of
Situation \ref{situation-mod-injective} where $M$ has
a $B$-module structure and $u$ is $B$-linear. This is the case most
often used in practice and it is significantly easier to prove
than the general case.

\begin{lemma}
\label{lemma-upstairs-finite-type-injective-into-flat-mod-m}
Let $A \to B$ be a local ring homomorphism of local rings which is
essentially of finite type. Let $u : N \to M$ be a $B$-module map.
If $N$ is a finite $B$-module, $M$ is flat over $A$, and
$\overline{u} : N/\mathfrak m_A N \to M/\mathfrak m_A M$ is injective,
then $u$ is $A$-universally injective, $N$ is of finite presentation over
$B$, and $N$ is flat over $A$.
\end{lemma}

\begin{proof}
Let $A \to A^h$ be the henselization of $A$. Let $B'$ be the localization
of $B \otimes_A A^h$ at the maximal ideal
$\mathfrak m_B \otimes A^h + B \otimes \mathfrak m_{A^h}$.
Since $B \to B'$ is flat (hence faithfully flat, see
Algebra, Lemma \ref{algebra-lemma-local-flat-ff}),
we may replace $A \to B$ with $A^h \to B'$,
the module $M$ by $M \otimes_B B'$, the module $N$ by $N \otimes_B B'$,
and $u$ by $u \otimes \text{id}_{B'}$, see
Algebra, Lemmas \ref{algebra-lemma-descend-properties-modules} and
\ref{algebra-lemma-flatness-descends-more-general}.
Thus we may assume that $A$ is a henselian local ring.
In this case our lemma follows from the more general
Lemma \ref{lemma-henselian-finite-type-injective-into-flat-mod-m}.
\end{proof}

\begin{lemma}
\label{lemma-valuation-ring-finite-type-injective-into-flat-mod-m}
If in Situation \ref{situation-mod-injective} the ring $A$ is a
valuation ring then the lemma holds.
\end{lemma}

\begin{proof}
Recall that an $A$-module is flat if and only if it is torsion free, see
More on Algebra, Lemma
\ref{more-algebra-lemma-valuation-ring-torsion-free-flat}.
Let $T \subset N$ be the $A$-torsion. Then $u(T) = 0$ and
$N/T$ is $A$-flat. Hence $N/T$ is finitely presented over $B$, see
More on Algebra, Lemma
\ref{more-algebra-lemma-flat-finite-type-valuation-ring-finite-presentation}.
Thus $T$ is a finite $B$-module, see
Algebra, Lemma \ref{algebra-lemma-extension}.
Since $N/T$ is $A$-flat we see that
$T/\mathfrak m_A T \subset N/\mathfrak m_A N$, see
Algebra, Lemma \ref{algebra-lemma-flat-tor-zero}.
As $\overline{u}$ is injective but $u(T) = 0$, we conclude that
$T/\mathfrak m_A T = 0$. Hence $T = 0$ by Nakayama's lemma, see
Algebra, Lemma \ref{algebra-lemma-NAK}. At this point we have
proved two out of the three assertions ($N$ is $A$-flat and
of finite presentation over $B$) and what is left is to show that
$u$ is universally injective.

\medskip\noindent
By Algebra, Theorem \ref{algebra-theorem-universally-exact-criteria}
it suffices to show that $N \otimes_A Q \to M \otimes_A Q$ is injective
for every finitely presented $A$-module $Q$. By
More on Algebra, Lemma
\ref{more-algebra-lemma-generalized-valuation-ring-modules}
we may assume $Q = A/(a)$ with $a \in \mathfrak m_A$ nonzero.
Thus it suffices to show that $N/aN \to M/aM$ is injective.
Let $x \in N$ with $u(x) \in aM$. By
Lemma \ref{lemma-flat-finite-type-local-valuation-ring-has-content}
we know that $x$ has a content ideal $I \subset A$. Since
$I$ is finitely generated
(More on Algebra, Lemma \ref{more-algebra-lemma-content-finitely-generated})
and $A$ is a valuation ring, we have $I = (b)$ for some $b$
(by Algebra, Lemma \ref{algebra-lemma-characterize-valuation-ring}).
By More on Algebra, Lemma \ref{more-algebra-lemma-equal-content}
the element $u(x)$ has content ideal $I$ as well.
Since $u(x) \in aM$ we see that $(b) \subset (a)$
by More on Algebra, Definition \ref{more-algebra-definition-content-ideal}.
Since $x \in bN$ we conclude $x \in aN$ as desired.
\end{proof}

\noindent
Consider the following situation
\begin{equation}
\label{equation-star}
\begin{matrix}
A \to B\text{ of finite presentation, }S \subset B
\text{ a multiplicative subset, and }\\
N\text{ a finitely presented }S^{-1}B\text{-module}
\end{matrix}
\end{equation}
In this situation a {\it pure spreadout} is an affine open
$U \subset \Spec(B)$ with $\Spec(S^{-1}B) \subset U$ and a
finitely presented $\mathcal{O}(U)$-module $N'$ extending $N$
such that $N'$ is $A$-projective and $N' \to N = S^{-1}N'$
is $A$-universally injective.

\medskip\noindent
In (\ref{equation-star}) if $A \to A_1$ is a ring map, then we
can base change: take $B_1 = B \otimes_A A_1$, let $S_1 \subset B_1$
be the image of $S$, and let $N_1 = N \otimes_A A_1$. This works
because $S_1^{-1}B_1 = S^{-1}B \otimes_A A_1$. We will use this
without further mention in the following.

\begin{lemma}
\label{lemma-properties-pure-spreadout}
In (\ref{equation-star}) if there exists a pure spreadout, then
\begin{enumerate}
\item elements of $N$ have content ideals in $A$, and
\item if $u : N \to M$ is a morphism to a flat $A$-module $M$
such that $N/\mathfrak m N \to M/\mathfrak m M$ is injective
for all maximal ideals $\mathfrak m$ of $A$, then $u$ is
$A$-universally injective.
\end{enumerate}
\end{lemma}

\begin{proof}
Choose $U$, $N'$ as in the definition of a pure spreadout.
Any element $x' \in N'$ has a content ideal in $A$ because
$N'$ is $A$-projective (this can easily be seen directly, but
it also follows from More on Algebra, Lemma
\ref{more-algebra-lemma-content-exists-flat-Mittag-Leffler} and
Algebra, Example \ref{algebra-example-ML}).
Since $N' \to N$ is $A$-universally injective, we see that
the image $x \in N$ of any $x' \in N'$ has a content ideal in $A$
(it is the same as the content ideal of $x'$).
For a general $x \in N$ we choose $s \in S$ such that
$s x$ is in the image of $N' \to N$ and we use that $x$ and $sx$
have the same content ideal.

\medskip\noindent
Let $u : N \to M$ be as in (2). To show that $u$ is $A$-universally
injective, we may replace $A$ by a localization at a maximal ideal
(small detail omitted). Assume $A$ is local with maximal ideal $\mathfrak m$.
Pick $s \in S$ and consider the composition
$$
N' \to N \xrightarrow{1/s} N \xrightarrow{u} M
$$
Each of these maps is injective modulo $\mathfrak m$, hence the composition
is $A$-universally injective by
Lemma \ref{lemma-universally-injective-local}.
Since $N = \colim_{s \in S} (1/s)N'$ we conclude that $u$
is $A$-inversally injective as a colimit of universally injective maps.
\end{proof}

\begin{lemma}
\label{lemma-find-pure-spreadout}
In (\ref{equation-star}) for every $\mathfrak p \in \Spec(A)$
there is a finitely generated ideal $I \subset \mathfrak pA_\mathfrak p$
such that over $A_\mathfrak p/I$ we have a pure spreadout.
\end{lemma}

\begin{proof}
We may replace $A$ by $A_\mathfrak p$. Thus we may assume $A$ is
local and $\mathfrak p$ is the maximal ideal $\mathfrak m$ of $A$.
We may write $N = S^{-1}N'$ for some finitely presented $B$-module $N'$
by clearing denominators in a presentation of $N$ over $S^{-1}B$.
Since $B/\mathfrak m B$ is Noetherian, the kernel $K$ of
$N'/\mathfrak m N' \to N/\mathfrak m N$ is finitely generated.
Thus we can pick $s \in S$ such that $K$ is annihilated by $s$.
After replacing $B$ by $B_s$ which is allowed as it just means passing
to an affine open subscheme of $\Spec(B)$, we find that the elements of $S$
are injective on $N'/\mathfrak m N'$. At this point we choose
a local subring $A_0 \subset A$ essentially of finite type over $\mathbf{Z}$,
a finite type ring map $A_0 \to B_0$ such that $B = A \otimes_{A_0} B_0$,
and a finite $B_0$-module $N'_0$ such that
$N' = B \otimes_{B_0} N'_0 = A \otimes_{A_0} N'_0$.
We claim that $I = \mathfrak m_{A_0} A$ works.
Namely, we have
$$
N'/IN' = N'_0/\mathfrak m_{A_0} N'_0 \otimes_{\kappa_{A_0}} A/I
$$
which is free over $A/I$. Multiplication by the elements of $S$
is injective after dividing out by the maximal ideal, hence
$N'/IN' \to N/IN$ is universally injective for example by
Lemma \ref{lemma-invert-universally-injective}.
\end{proof}

\begin{lemma}
\label{lemma-universally-injective-if-flat}
In (\ref{equation-star}) assume $N$ is $A$-flat, $M$ is a flat $A$-module,
and $u : N \to M$ is an $A$-module map such that
$u \otimes \text{id}_{\kappa(\mathfrak p)}$ is injective for all
$\mathfrak p \in \Spec(A)$. Then $u$ is $A$-universally injective.
\end{lemma}

\begin{proof}
By Algebra, Lemma \ref{algebra-lemma-check-universally-injective-into-flat}
it suffices to check that $N/IN \to M/IM$ is injective for every
ideal $I \subset A$. After replacing $A$ by $A/I$ we see that it suffices
to prove that $u$ is injective.

\medskip\noindent
Proof that $u$ is injective. Let $x \in N$ be a nonzero element of the
kernel of $u$. Then there exists a weakly associated prime $\mathfrak p$
of the module $Ax$, see Algebra, Lemma \ref{algebra-lemma-weakly-ass-zero}.
Replacing $A$ by $A_\mathfrak p$ we may assume $A$ is local and
we find a nonzero element $y \in Ax$ whose annihilator has radical
equal to $\mathfrak m_A$, see
Algebra, Lemma \ref{algebra-lemma-weakly-ass-local}.
Thus $\text{Supp}(y) \subset \Spec(S^{-1}B)$ is nonempty and
contained in the closed fibre of $\Spec(S^{-1}B) \to \Spec(A)$.
Let $I \subset \mathfrak m_A$ be a
finitely generated ideal so that we have a pure spreadout over $A/I$, see
Lemma \ref{lemma-find-pure-spreadout}. Then $I^n y = 0$ for some $n$. Now
$y \in \text{Ann}_M(I^n) = \text{Ann}_A(I^n) \otimes_R N$ by flatness.
Thus, to get the desired contradiction, it suffices to show that
$$
\text{Ann}_A(I^n) \otimes_R N
\longrightarrow
\text{Ann}_A(I^n) \otimes_R M
$$
is injective. Since $N$ and $M$ are flat and since $\text{Ann}_A(I^n)$
is annihilated by $I^n$, it suffices to show that
$Q \otimes_A N \to Q \otimes_A M$ is injective for every $A$-module
$Q$ annihilated by $I$. This holds by our choice of $I$ and
Lemma \ref{lemma-properties-pure-spreadout} part (2).
\end{proof}

\begin{lemma}
\label{lemma-big-intersection-is-zero}
Let $A$ be a local domain which is not a field.
Let $S$ be a set of finitely generated ideals of $A$.
Assume that $S$ is closed under products and such that
$\bigcup_{I \in S} V(I)$ is the complement of the generic point of $\Spec(A)$.
Then $\bigcap_{I \in S} I = (0)$.
\end{lemma}

\begin{proof}
Since $\mathfrak m_A \subset A$ is not the generic point of $\Spec(A)$
we see that $I \subset \mathfrak m_A$ for at least one $I \in S$.
Hence $\bigcap_{I \in S} I \subset \mathfrak m_A$.
Let $f \in \mathfrak m_A$ be nonzero. Then
$V(f) \subset \bigcup_{I \in S} V(I)$.
Since the constructible topology on $V(f)$ is quasi-compact
(Topology, Lemma \ref{topology-lemma-constructible-hausdorff-quasi-compact}
and
Algebra, Lemma \ref{algebra-lemma-spec-spectral})
we find that $V(f) \subset V(I_1) \cup \ldots \cup V(I_n)$
for some $I_j \in S$. Because $I_1 \ldots I_n \in S$ we see that
$V(f) \subset V(I)$ for some $I$. As $I$ is finitely generated
this implies that $I^m \subset (f)$ for some $m$ and since
$S$ is closed under products we see that $I \subset (f^2)$ for
some $I \in S$. Then it is not possible to have $f \in I$.
\end{proof}

\begin{lemma}
\label{lemma-closed-points-complement}
Let $A$ be a local ring. Let $I, J \subset A$ be ideals.
If $J$ is finitely generated and $I \subset J^n$ for all $n \geq 1$,
then $V(I)$ contains the closed points of $\Spec(A) \setminus V(J)$.
\end{lemma}

\begin{proof}
Let $\mathfrak p \subset A$ be a closed point of $\Spec(A) \setminus V(J)$.
We want to show that $I \subset \mathfrak p$. If not, then some $f \in I$
maps to a nonzero element of $A/\mathfrak p$. Note that
$V(J) \cap \Spec(A/\mathfrak p)$ is the set of non-generic points.
Hence by Lemma \ref{lemma-big-intersection-is-zero} applied
to the collection of ideals $J^nA/\mathfrak p$ we conclude that
the image of $f$ is zero in $A/\mathfrak p$.
\end{proof}

\begin{lemma}
\label{lemma-make-smaller-flatness-ideal}
Let $A$ be a local ring. Let $I \subset A$ be an ideal.
Let $U \subset \Spec(A)$ be quasi-compact open.
Let $M$ be an $A$-module. Assume that
\begin{enumerate}
\item $M/IM$ is flat over $A/I$,
\item $M$ is flat over $U$,
\end{enumerate}
Then $M/I_2M$ is flat over $A/I_2$ where
$I_2 = \Ker(I \to \Gamma(U, I/I^2))$.
\end{lemma}

\begin{proof}
It suffices to show that
$M \otimes_A I/I_2 \to IM/I_2M$ is injective, see
Algebra, Lemma \ref{algebra-lemma-what-does-it-mean-again}.
This is true over $U$ by assumption (2). Thus it suffices to show
that $M \otimes_A I/I_2$ injects into its sections over $U$.
We have $M \otimes_A I/I_2 = M/IM \otimes_A I/I_2$ and
$M/IM$ is a filtered colimit of finite free $A/I$-modules
(Algebra, Theorem \ref{algebra-theorem-lazard}).
Hence it suffices to show that $I/I_2$ injects into its sections
over $U$, which follows from the construction of $I_2$.
\end{proof}

\begin{proposition}
\label{proposition-finite-type-injective-into-flat-mod-m}
Let $A \to B$ be a local ring homomorphism of local rings
which is essentially of finite type. Let $M$ be a flat $A$-module,
$N$ a finite $B$-module and $u : N \to M$ an $A$-module map such that
$\overline{u} : N/\mathfrak m_AN \to M/\mathfrak m_AM$ is injective.
Then $u$ is $A$-universally injective, $N$ is of finite presentation over
$B$, and $N$ is flat over $A$.
\end{proposition}

\begin{proof}
We may assume that $B$ is the localization of a finitely presented
$A$-algebra $B_0$ and that $N$ is the localization of a
finitely presented $B_0$-module $M_0$, see
Lemma \ref{lemma-reduce-finite-type-injective-into-flat-mod-m}.
By More on Morphisms, Lemma
\ref{more-morphisms-lemma-generic-flatness-stratification}
there exists a ``generic flatness stratification''
for $\widetilde{M_0}$ on $\Spec(B_0)$ over $\Spec(A)$.
Translating back to $N$ we find a sequence of closed subschemes
$$
S = \Spec(A) \supset S_0 \supset S_1 \supset \ldots \supset S_t = \emptyset
$$
with $S_i \subset S$ cut out by a finitely generated ideal of $A$
such that the pullback of $\widetilde{N}$ to
$\Spec(B) \times_S (S_i \setminus S_{i + 1})$ is flat over
$S_i \setminus S_{i + 1}$. We will prove the proposition by
induction on $t$ (the base case $t = 1$ will be proved in parallel
with the other steps). Let $\Spec(A/J_i)$ be the scheme theoretic
closure of $S_i \setminus S_{i + 1}$.

\medskip\noindent
{\bf Claim 1.} $N/J_iN$ is flat over $A/J_i$. This is immediate for
$i = t - 1$ and follows from the induction hypothesis for $i > 0$.
Thus we may assume $t > 1$, $S_{t - 1} \not = \emptyset$, and
$J_0 = 0$ and we have to prove that $N$ is flat. Let $J \subset A$
be the ideal defining $S_1$. By induction on $t$ again, we also
have flatness modulo powers of $J$. Let $A^h$ be the henselization of $A$
and let $B'$ be the localization of $B \otimes_A A^h$ at the maximal ideal
$\mathfrak m_B \otimes A^h + B \otimes \mathfrak m_{A^h}$. Then $B \to B'$
is faithfully flat. Set $N' = N \otimes_B B'$. Note that $N'$
is $A^h$-flat if and only if $N$ is $A$-flat. By
Theorem \ref{theorem-flattening-local} there is a smallest ideal
$I \subset A^h$ such that $N'/IN'$ is flat over $A^h/I$, and
$I$ is finitely generated. By the above $I \subset J^nA^h$ for
all $n \geq 1$. Let $S_i^h \subset \Spec(A^h)$ be the inverse image
of $S_i \subset \Spec(A)$. By Lemma \ref{lemma-closed-points-complement}
we see that $V(I)$ contains the closed points of $U = \Spec(A^h) - S_1^h$.
By construction $N'$ is $A^h$-flat over $U$.
By Lemma \ref{lemma-make-smaller-flatness-ideal} we see that $N'/I_2N'$
is flat over $A/I_2$, where
$I_2 = \Ker(I \to \Gamma(U, I/I^2))$. Hence $I = I_2$ by minimality
of $I$. This implies that $I = I^2$ locally on $U$, i.e.,
we have $I\mathcal{O}_{U, u} = (0)$ or $I\mathcal{O}_{U, u} = (1)$
for all $u \in U$. Since $V(I)$ contains the closed points of $U$
we see that $I = 0$ on $U$. Since $U \subset \Spec(A^h)$ is scheme
theoretically dense (because replaced $A$ by $A/J_0$ in the beginning
of this paragraph), we see that $I = 0$. Thus $N'$ is $A^h$-flat
and hence Claim 1 holds.

\medskip\noindent
We return to the situation as laid out before Claim 1. With
$A^h$ the henselization of $A$, with $B'$ the localization
of $B \otimes_A A^h$ at the maximal ideal
$\mathfrak m_B \otimes A^h + B \otimes \mathfrak m_{A^h}$, and with
$N' = N \otimes_B B'$ we now see that the flattening ideal $I \subset A^h$
of Theorem \ref{theorem-flattening-local} is nilpotent.
If $nil(A^h)$ denotes the ideal of nilpotent elements, then
$nil(A^h) = nil(A) A^h$
(More on Algebra, Lemma \ref{more-algebra-lemma-henselization-nil}).
Hence there exists a finitely generated
nilpotent ideal $I_0 \subset A$ such that $N/I_0N$ is flat over $A/I_0$.

\medskip\noindent
{\bf Claim 2.} For every prime ideal $\mathfrak p \subset A$
the map
$\kappa(\mathfrak p) \otimes_A N \to \kappa(\mathfrak p) \otimes_A M$
is injective. We say $\mathfrak p$ is bad it this is false.
Suppose that $C$ is a nonempty chain of bad primes and set
$\mathfrak p^* = \bigcup_{\mathfrak p \in C} \mathfrak p$.
By Lemma \ref{lemma-find-pure-spreadout}
there is a finitely generated ideal
$\mathfrak a \subset \mathfrak p^*A_{\mathfrak p^*}$
such that there is a pure spreadout over $V(\mathfrak a)$.
If $\mathfrak p^*$ were good, then it would follow from
Lemma \ref{lemma-properties-pure-spreadout}
that the points of $V(\mathfrak a)$ are good.
However, since $\mathfrak a$ is finitely generated and since
$\mathfrak p^*A_{\mathfrak p^*} = \bigcup_{\mathfrak p \in C}A_{\mathfrak p^*}$
we see that $V(\mathfrak a)$ contains a $\mathfrak p \in C$, contradiction.
Hence $\mathfrak p^*$ is bad. By Zorn's lemma, if there exists a
bad prime, there exists a maximal one, say $\mathfrak p$.
In other words, we may assume every $\mathfrak p' \supset \mathfrak p$,
$\mathfrak p' \not = \mathfrak p$ is good.
In this case we see that for every $f \in A$, $f \not \in \mathfrak p$
the map $u \otimes \text{id}_{A/(\mathfrak p + f)}$ is universally
injective, see Lemma \ref{lemma-universally-injective-if-flat}.
Thus it suffices to show that $N/\mathfrak p N$ is separated
for the topology defined by the submodules $f(N/\mathfrak pN)$.
Since $B \to B'$ is faithfully flat, it is enough to prove the
same for the module $N'/\mathfrak p N'$.
By Lemma \ref{lemma-flat-finite-type-local-colimit-free} and
More on Algebra, Lemma
\ref{more-algebra-lemma-content-exists-flat-Mittag-Leffler}
elements of $N'/\mathfrak pN'$ have content ideals in $A^h/\mathfrak pA^h$.
Thus it suffices to show that
$\bigcap_{f \in A, f \not \in \mathfrak p} f(A^h/\mathfrak p A^h) = 0$.
Then it suffices to show the same for
$A^h/\mathfrak q A^h$ for every prime $\mathfrak q \subset A^h$
minimal over $\mathfrak p A^h$. Because $A \to A^h$ is the henselization,
every $\mathfrak q$ contracts to $\mathfrak p$ and every
$\mathfrak q' \supset \mathfrak q$, $\mathfrak q' \not = \mathfrak q$
contracts to a prime $\mathfrak p'$ which strictly contains $\mathfrak p$.
Thus we get the vanishing of the intersections from
Lemma \ref{lemma-big-intersection-is-zero}.

\medskip\noindent
At this point we can put everything together. Namely, using
Claim 1 and Claim 2 we see that $N/I_0 N \to M/I_0M$ is
$A/I_0$-universally injective by
Lemma \ref{lemma-universally-injective-if-flat}.
Then the diagrams
$$
\xymatrix{
N \otimes_A (I_0^n/I_0^{n + 1}) \ar[r] \ar[d] &
M \otimes_A (I_0^n/I_0^{n + 1}) \ar@{=}[d] \\
I_0^n N /I_0^{n + 1} N \ar[r] &
I_0^n M /I_0^{n + 1} M
}
$$
show that the left vertical arrows are injective. Hence by
Algebra, Lemma \ref{algebra-lemma-what-does-it-mean-again}
we see that $N$ is flat. In a similar way the
universal injectivity of $u$ can be reduced (even without
proving flatness of $N$ first) to the one modulo $I_0$. This finishes
the proof.
\end{proof}


\section{Flat finite type modules, Part III}
\label{section-finite-type-flat-III}

\noindent
The following result is one of the main results of this chapter.

\begin{theorem}
\label{theorem-check-flatness-at-associated-points}
Let $f : X \to S$ be locally of finite type.
Let $\mathcal{F}$ be a quasi-coherent $\mathcal{O}_X$-module of finite type.
Let $x \in X$ with image $s \in S$.
The following are equivalent
\begin{enumerate}
\item $\mathcal{F}$ is flat at $x$ over $S$, and
\item for every $x' \in \text{Ass}_{X_s}(\mathcal{F}_s)$ which
specializes to $x$ we have that $\mathcal{F}$ is flat at $x'$ over $S$.
\end{enumerate}
\end{theorem}

\begin{proof}
It is clear that (1) implies (2) as $\mathcal{F}_{x'}$ is a localization
of $\mathcal{F}_x$ for every point which specializes to $x$.
Set $A = \mathcal{O}_{S, s}$, $B = \mathcal{O}_{X, x}$ and
$N = \mathcal{F}_x$. Let $\Sigma \subset B$ be the multiplicative
subset of $B$ of elements which act as nonzerodivisors on $N/\mathfrak m_AN$.
Assumption (2) implies that $\Sigma^{-1}N$ is $A$-flat by the description
of $\Spec(\Sigma^{-1}N)$ in
Lemma \ref{lemma-homothety-spectrum}.
On the other hand, the map $N \to \Sigma^{-1}N$ is injective modulo
$\mathfrak m_A$ by construction. Hence applying
Lemma \ref{lemma-upstairs-finite-type-injective-into-flat-mod-m}
we win.
\end{proof}

\noindent
Now we apply this directly to obtain the following useful results.

\begin{lemma}
\label{lemma-check-along-closed-fibre}
Let $S$ be a local scheme with closed point $s$.
Let $f : X \to S$ be locally of finite type.
Let $\mathcal{F}$ be a finite type quasi-coherent $\mathcal{O}_X$-module.
Assume that
\begin{enumerate}
\item every point of $\text{Ass}_{X/S}(\mathcal{F})$ specializes
to a point of the closed fibre $X_s$\footnote{For example this holds if
$f$ is finite type and $\mathcal{F}$ is pure along $X_s$, or
if $f$ is proper.},
\item $\mathcal{F}$ is flat over $S$ at every point of $X_s$.
\end{enumerate}
Then $\mathcal{F}$ is flat over $S$.
\end{lemma}

\begin{proof}
This is immediate from the fact that it suffices to check for
flatness at points of the relative assassin of $\mathcal{F}$
over $S$ by
Theorem \ref{theorem-check-flatness-at-associated-points}.
\end{proof}











\section{Universal flattening}
\label{section-flattening-final}

\noindent
If $f : X \to S$ is a proper, finitely presented morphism
of schemes then one can find a universal flattening of $f$.
In this section we discuss this and some of its variants.

\begin{lemma}
\label{lemma-free-at-generic-points-representable}
In Situation \ref{situation-free-at-generic-points}.
For each $p \geq 0$ the functor $H_p$
(\ref{equation-free-at-generic-points}) is representable
by a locally closed immersion $S_p \to S$. If $\mathcal{F}$
is of finite presentation, then $S_p \to S$ is of finite presentation.
\end{lemma}

\begin{proof}
For each $S$ we will prove the statement for all $p \geq 0$ concurrently.
The functor $H_p$ is a sheaf for the fppf topology by
Lemma \ref{lemma-free-at-generic-points}.
Hence combining
Descent, Lemma \ref{descent-lemma-descent-data-sheaves},
More on Morphisms, Lemma
\ref{more-morphisms-lemma-separated-locally-quasi-finite-morphisms-fppf-descend}
, and
Descent, Lemma \ref{descent-lemma-descending-fppf-property-immersion}
we see that the question is local for the \'etale topology on $S$.
In particular, the question is Zariski local on $S$.

\medskip\noindent
For $s \in S$ denote $\xi_s$ the unique generic point of the fibre $X_s$.
Note that for every $s \in S$ the restriction $\mathcal{F}_s$ of
$\mathcal{F}$ is locally free of some rank $p(s) \geq 0$ in some
neighbourhood of $\xi_s$. (As $X_s$ is irreducible
and smooth this follows from generic flatness for $\mathcal{F}_s$ over
$X_s$, see
Algebra, Lemma \ref{algebra-lemma-generic-flatness-Noetherian}
although this is overkill.) For future reference we note that
$$
p(s) =
\dim_{\kappa(\xi_s)}(
\mathcal{F}_{\xi_s} \otimes_{\mathcal{O}_{X, \xi_s}} \kappa(\xi_s)
).
$$
In particular $H_{p(s)}(s)$ is nonempty and $H_q(s)$ is empty
if $q \not = p(s)$.

\medskip\noindent
Let $U \subset X$ be an open subscheme.
As $f : X \to S$ is smooth, it is open.
It is immediate from (\ref{equation-free-at-generic-points})
that the functor $H_p$ for the pair $(f|_U : U \to f(U), \mathcal{F}|_U)$
and the functor $H_p$ for the pair
$(f|_{f^{-1}(f(U))}, \mathcal{F}|_{f^{-1}(f(U))})$
are the same. Hence to prove the existence of $S_p$ over $f(U)$ we may
always replace $X$ by $U$.

\medskip\noindent
Pick $s \in S$. There exists an affine open neighbourhood $U$
of $\xi_s$ such that $\mathcal{F}|_U$ can be generated by at most
$p(s)$ elements. By the arguments above we see that in order to prove
the statement for $H_{p(s)}$ in an neighbourhood of $s$ we may assume
that $\mathcal{F}$ is generated by $p(s)$ elements, i.e., that there exists
a surjection
$$
u : \mathcal{O}_X^{\oplus p(s)} \longrightarrow \mathcal{F}
$$
In this case it is clear that $H_{p(s)}$ is equal to $F_{iso}$
(\ref{equation-iso}) for the map $u$ (this follows immediately from
Lemma \ref{lemma-injectivity-map-source-flat-pure}
but also from
Lemma \ref{lemma-induction-step-fp}
after shrinking a bit more so that both $S$ and $X$ are affine.)
Thus we may apply
Theorem \ref{theorem-flattening-map}
to see that $H_{p(s)}$ is representable by a closed immersion in a
neighbourhood of $s$.

\medskip\noindent
The result follows formally from the above.
Namely, the arguments above show that locally on $S$ the function
$s \mapsto p(s)$ is bounded. Hence we may use induction
on $p = \max_{s \in S} p(s)$. The functor $H_p$ is representable
by a closed immersion $S_p \to S$ by the above. Replace $S$ by
$S \setminus S_p$ which drops the maximum by at least one and
we win by induction hypothesis.

\medskip\noindent
Assume $\mathcal{F}$ is of finite presentation.
Then $S_p \to S$ is locally of finite presentation by
Lemma \ref{lemma-free-at-generic-points} part (2) combined with
Limits, Remark \ref{limits-remark-limit-preserving}.
Then we redo the induction argument in the paragraph to
see that each $S_p$ is quasi-compact when $S$ is affine:
first if $p = \max_{s \in S} p(s)$, then $S_p \subset S$
is closed (see above) hence quasi-compact. Then $U = S \setminus S_p$
is quasi-compact open in $S$ because $S_p \to S$ is a closed
immersion of finite presentation (see discussion in Morphisms, Section
\ref{morphisms-section-constructible} for example). Then $S_{p - 1} \to U$
is a closed immersion of finite presentation, and so $S_{p - 1}$
is quasi-compact and $U' = S \setminus (S_p \cup S_{p - 1})$
is quasi-compact. And so on.
\end{proof}

\begin{lemma}
\label{lemma-localize-flat-dimension-n}
In Situation \ref{situation-flat-dimension-n}.
Let $h : X' \to X$ be an \'etale morphism.
Set $\mathcal{F}' = h^*\mathcal{F}$ and $f' = f \circ h$.
Let $F_n'$ be (\ref{equation-flat-dimension-n})
associated to $(f' : X' \to S, \mathcal{F}')$.
Then $F_n$ is a subfunctor of $F_n'$ and if
$h(X') \supset \text{Ass}_{X/S}(\mathcal{F})$, then $F_n = F'_n$.
\end{lemma}

\begin{proof}
Let $T \to S$ be any morphism. Then $h_T : X'_T \to X_T$ is \'etale as a
base change of the \'etale morphism $g$. For $t \in T$ denote
$Z \subset X_t$ the set of points where $\mathcal{F}_T$ is not
flat over $T$, and similarly denote $Z' \subset X'_t$ the set of
points where $\mathcal{F}'_T$ is not flat over $T$. As
$\mathcal{F}'_T = h_T^*\mathcal{F}_T$ we see that
$Z' = h_t^{-1}(Z)$, see
Morphisms, Lemma \ref{morphisms-lemma-flat-permanence}.
Hence $Z' \to Z$ is an \'etale morphism, so $\dim(Z') \leq \dim(Z)$
(for example by
Descent, Lemma \ref{descent-lemma-dimension-at-point-local}
or just because an \'etale morphism is smooth of relative dimension $0$).
This implies that $F_n \subset F_n'$.

\medskip\noindent
Finally, suppose that $h(X') \supset \text{Ass}_{X/S}(\mathcal{F})$
and that $T \to S$ is a morphism such that $F_n'(T)$ is nonempty, i.e.,
such that $\mathcal{F}'_T$ is flat in dimensions $\geq n$ over $T$.
Pick a point $t \in T$ and let $Z \subset X_t$ and $Z' \subset X'_t$
be as above. To get a contradiction assume that $\dim(Z) \geq n$.
Pick a generic point $\xi \in Z$ corresponding to a component
of dimension $\geq n$. Let $x \in \text{Ass}_{X_t}(\mathcal{F}_t)$
be a generalization of $\xi$. Then $x$ maps to a point of
$\text{Ass}_{X/S}(\mathcal{F})$ by
Divisors, Lemma \ref{divisors-lemma-base-change-relative-assassin} and
Remark \ref{divisors-remark-base-change-relative-assassin}.
Thus we see that $x$ is in the image of $h_T$, say
$x = h_T(x')$ for some $x' \in X'_T$. But $x' \not \in Z'$
as $x \leadsto \xi$ and $\dim(Z') < n$. Hence $\mathcal{F}'_T$
is flat over $T$ at $x'$ which implies that $\mathcal{F}_T$ is flat
at $x$ over $T$ (by
Morphisms, Lemma \ref{morphisms-lemma-flat-permanence}).
Since this holds for every such $x$ we conclude
that $\mathcal{F}_T$ is flat over $T$ at $\xi$ by
Theorem \ref{theorem-check-flatness-at-associated-points}
which is the desired contradiction.
\end{proof}

\begin{lemma}
\label{lemma-compare-H-F}
Assume that $X \to S$ is a smooth morphism of affine schemes
with geometrically irreducible fibres of dimension $d$ and that
$\mathcal{F}$ is a quasi-coherent $\mathcal{O}_X$-module of finite
presentation. Then $F_d = \coprod_{p = 0, \ldots, c} H_p$
for some $c \geq 0$ with $F_d$ as in
(\ref{equation-flat-dimension-n}) and $H_p$ as in
(\ref{equation-free-at-generic-points}).
\end{lemma}

\begin{proof}
As $X$ is affine and $\mathcal{F}$ is quasi-coherent of finite presentation
we know that $\mathcal{F}$ can be generated by $c \geq 0$ elements.
Then $\dim_{\kappa(x)}(\mathcal{F}_x \otimes \kappa(x))$
in any point $x \in X$ never exceeds $c$. In particular $H_p = \emptyset$
for $p > c$. Moreover, note that there certainly is an inclusion
$\coprod H_p \to F_d$. Having said this the content
of the lemma is that, if a base change $\mathcal{F}_T$ is flat in
dimensions $\geq d$ over $T$ and if $t \in T$, then $\mathcal{F}_T$ is
free of some rank $r$ in an open neighbourhood $U \subset X_T$
of the unique generic point $\xi$ of $X_t$. Namely, then $H_r$
contains the image of $U$ which is an open neighbourhood of $t$.
The existence of $U$ follows from
More on Morphisms, Lemma
\ref{more-morphisms-lemma-flat-and-free-at-point-fibre}.
\end{proof}

\begin{lemma}
\label{lemma-flat-dimension-n-representable}
In Situation \ref{situation-flat-dimension-n}.
Let $s \in S$ let $d \geq 0$. Assume
\begin{enumerate}
\item there exists a complete d\'evissage
of $\mathcal{F}/X/S$ over some point $s \in S$,
\item $X$ is of finite presentation over $S$,
\item $\mathcal{F}$ is an $\mathcal{O}_X$-module of finite presentation, and
\item $\mathcal{F}$ is flat in dimensions $\geq d + 1$ over $S$.
\end{enumerate}
Then after possibly replacing $S$ by an open neighbourhood
of $s$ the functor $F_d$ (\ref{equation-flat-dimension-n})
is representable by a monomorphism $Z_d \to S$ of finite presentation.
\end{lemma}

\begin{proof}
A preliminary remark is that $X$, $S$ are affine schemes and that it
suffices to prove $F_d$ is representable by a monomorphism of finite
presentation $Z_d \to S$ on the category of affine schemes over $S$.
(Of course we do not require $Z_d$ to be affine.)
Hence throughout the proof of
the lemma we work in the category of affine schemes over $S$.

\medskip\noindent
Let $(Z_k, Y_k, i_k, \pi_k, \mathcal{G}_k, \alpha_k)_{k = 1, \ldots, n}$
be a complete d\'evissage of $\mathcal{F}/X/S$ over $s$, see
Definition \ref{definition-complete-devissage}.
We will use induction on the length $n$ of the d\'evissage.
Recall that $Y_k \to S$ is smooth with geometrically irreducible fibres, see
Definition \ref{definition-one-step-devissage}.
Let $d_k$ be the relative dimension of $Y_k$ over $S$.
Recall that $i_{k, *}\mathcal{G}_k = \Coker(\alpha_k)$ and
that $i_k$ is a closed immersion.
By the definitions referenced above we have
$d_1 = \dim(\text{Supp}(\mathcal{F}_s))$ and
$$
d_k = \dim(\text{Supp}(\Coker(\alpha_{k - 1})_s))
= \dim(\text{Supp}(\mathcal{G}_{k, s}))
$$
for $k = 2, \ldots, n$. It follows that $d_1 > d_2 > \ldots > d_n \geq 0$
because $\alpha_k$ is an isomorphism in the generic point of $(Y_k)_s$.

\medskip\noindent
Note that $i_1$ is a closed immersion and
$\mathcal{F} = i_{1, *}\mathcal{G}_1$.
Hence for any morphism of schemes $T \to S$ with $T$ affine,
we have $\mathcal{F}_T = i_{1, T, *}\mathcal{G}_{1, T}$ and
$i_{1, T}$ is still a closed immersion of schemes over $T$.
Thus $\mathcal{F}_T$ is flat in dimensions $\geq d$ over $T$
if and only if $\mathcal{G}_{1, T}$ is flat in dimensions $\geq d$ over $T$.
Because $\pi_1 : Z_1 \to Y_1$ is finite we see in the same manner that
$\mathcal{G}_{1, T}$ is flat in dimensions $\geq d$ over $T$
if and only if $\pi_{1, T, *}\mathcal{G}_{1, T}$ is flat in dimensions
$\geq d$ over $T$. The same arguments work for
``flat in dimensions $\geq d + 1$'' and we conclude in particular that
$\pi_{1, *}\mathcal{G}_1$ is flat over $S$ in dimensions $\geq d + 1$
by our assumption on $\mathcal{F}$.

\medskip\noindent
Suppose that $d_1 > d$. It follows from the discussion above that
in particular $\pi_{1, *}\mathcal{G}_1$ is flat over $S$ at
the generic point of $(Y_1)_s$. By
Lemma \ref{lemma-induction-step-fp}
we may replace $S$ by an affine neighbourhood of $s$ and assume that
$\alpha_1$ is $S$-universally injective. Because $\alpha_1$ is
$S$-universally injective, for any morphism $T \to S$ with $T$ affine,
we have a short exact sequence
$$
0 \to \mathcal{O}_{Y_{1, T}}^{\oplus r_1}
\to \pi_{1, T, *}\mathcal{G}_{1, T} \to \Coker(\alpha_1)_T \to 0
$$
and still the first arrow is $T$-universally injective. Hence the set
of points of $(Y_1)_T$ where $\pi_{1, T, *}\mathcal{G}_{1, T}$ is flat over
$T$ is the same as the set of points of $(Y_1)_T$ where
$\Coker(\alpha_1)_T$ is flat over $S$. In this way the question
reduces to the sheaf $\Coker(\alpha_1)$ which has a complete
d\'evissage of length $n - 1$ and we win by induction.

\medskip\noindent
If $d_1 < d$ then $F_d$ is represented by $S$ and we win.

\medskip\noindent
The last case is the case $d_1 = d$. This case follows from a combination of
Lemma \ref{lemma-compare-H-F}
and
Lemma \ref{lemma-free-at-generic-points-representable}.
\end{proof}

\begin{theorem}
\label{theorem-flat-dimension-n-representable}
In Situation \ref{situation-flat-dimension-n}.
Assume moreover that $f$ is of finite presentation, that
$\mathcal{F}$ is an $\mathcal{O}_X$-module of finite presentation,
and that $\mathcal{F}$ is pure relative to $S$.
Then $F_n$ is representable by a monomorphism
$Z_n \to S$ of finite presentation.
\end{theorem}

\begin{proof}
The functor $F_n$ is a sheaf for the fppf topology by
Lemma \ref{lemma-flat-dimension-n}.
Observe that a monomorphism of finite presentation is
separated and quasi-finite (Morphisms, Lemma
\ref{morphisms-lemma-monomorphism-loc-finite-type-loc-quasi-finite}).
Hence combining
Descent, Lemma \ref{descent-lemma-descent-data-sheaves},
More on Morphisms, Lemma
\ref{more-morphisms-lemma-separated-locally-quasi-finite-morphisms-fppf-descend}
, and
Descent, Lemmas \ref{descent-lemma-descending-property-monomorphism} and
\ref{descent-lemma-descending-property-finite-presentation}
we see that the question is local for the \'etale topology on $S$.

\medskip\noindent
In particular the situation is local for the Zariski topology on $S$
and we may assume that $S$ is affine. In this case the dimension of the
fibres of $f$ is bounded above, hence we see that $F_n$ is representable
for $n$ large enough. Thus we may use descending induction on $n$.
Suppose that we know $F_{n + 1}$ is representable by a monomorphism
$Z_{n + 1} \to S$ of finite presentation. Consider the base change
$X_{n + 1} = Z_{n + 1} \times_S X$ and the pullback $\mathcal{F}_{n + 1}$
of $\mathcal{F}$ to $X_{n + 1}$. The morphism $Z_{n + 1} \to S$ is
quasi-finite as it is a monomorphism of finite presentation, hence
Lemma \ref{lemma-quasi-finite-base-change}
implies that $\mathcal{F}_{n + 1}$ is pure relative to $Z_{n + 1}$.
Since $F_n$ is a subfunctor of $F_{n + 1}$ we conclude that in order
to prove the result for $F_n$ it suffices to prove the result for the
corresponding functor for the situation
$\mathcal{F}_{n + 1}/X_{n + 1}/Z_{n + 1}$.
In this way we reduce to proving the result for $F_n$ in case
$S_{n + 1} = S$, i.e., we may assume that $\mathcal{F}$ is flat
in dimensions $\geq n + 1$ over $S$.

\medskip\noindent
Fix $n$ and assume $\mathcal{F}$ is flat in dimensions $\geq n + 1$
over $S$. To finish the proof we have to show that $F_n$ is representable
by a monomorphism $Z_n \to S$ of finite presentation.
Since the question is local in the \'etale topology on $S$ it suffices to
show that for every $s \in S$ there exists an elementary \'etale neighbourhood
$(S', s') \to (S, s)$ such that the result holds after base change to $S'$.
Thus by
Lemma \ref{lemma-existence-complete}
we may assume there exist \'etale morphisms $h_j : Y_j \to X$,
$j = 1, \ldots, m$ such that for each $j$ there exists a complete
d\'evissage of $\mathcal{F}_j/Y_j/S$ over $s$,
where $\mathcal{F}_j$ is the pullback of $\mathcal{F}$ to $Y_j$
and such that $X_s \subset \bigcup h_j(Y_j)$. Note that by
Lemma \ref{lemma-localize-flat-dimension-n}
the sheaves $\mathcal{F}_j$ are still flat over in
dimensions $\geq n + 1$ over $S$.
Set $W = \bigcup h_j(Y_j)$, which is a quasi-compact open of $X$.
As $\mathcal{F}$ is pure along $X_s$ we see that
$$
E = \{t \in S \mid \text{Ass}_{X_t}(\mathcal{F}_t) \subset W \}.
$$
contains all generalizations of $s$. By
More on Morphisms,
Lemma \ref{more-morphisms-lemma-relative-assassin-constructible}
$E$ is a constructible subset of $S$. We have seen that
$\Spec(\mathcal{O}_{S, s}) \subset E$. By
Morphisms, Lemma \ref{morphisms-lemma-constructible-containing-open}
we see that $E$ contains an open neighbourhood of $s$.
Hence after shrinking $S$ we may assume that $E = S$.
It follows from
Lemma \ref{lemma-localize-flat-dimension-n}
that it suffices to prove the lemma for the functor $F_n$ associated to
$X = \coprod Y_j$ and $\mathcal{F} = \coprod \mathcal{F}_j$.
If $F_{j, n}$ denotes the functor for $Y_j \to S$ and the sheaf
$\mathcal{F}_i$ we see that $F_n = \prod F_{j, n}$. Hence it suffices
to prove each $F_{j, n}$ is representable by some monomorphism
$Z_{j, n} \to S$ of finite presentation, since then
$$
Z_n = Z_{1, n} \times_S \ldots \times_S Z_{m, n}
$$
Thus we have reduced the theorem to the special case handled in
Lemma \ref{lemma-flat-dimension-n-representable}.
\end{proof}

\noindent
We make explicit what the theorem means in terms of universal
flattenings in the following lemma.

\begin{lemma}
\label{lemma-when-universal-flattening}
Let $f : X \to S$ be a morphism of schemes.
Let $\mathcal{F}$ be a quasi-coherent $\mathcal{O}_X$-module.
\begin{enumerate}
\item If $f$ is of finite presentation, $\mathcal{F}$ is an
$\mathcal{O}_X$-module of finite presentation, and $\mathcal{F}$ is
pure relative to $S$, then there exists a universal flattening
$S' \to S$ of $\mathcal{F}$. Moreover $S' \to S$ is a monomorphism
of finite presentation.
\item If $f$ is of finite presentation and $X$ is pure relative to $S$,
then there exists a universal flattening $S' \to S$ of $X$.
Moreover $S' \to S$ is a monomorphism of finite presentation.
\item If $f$ is proper and of finite presentation and $\mathcal{F}$ is an
$\mathcal{O}_X$-module of finite presentation, then there exists a
universal flattening $S' \to S$ of $\mathcal{F}$. Moreover $S' \to S$ is
a monomorphism of finite presentation.
\item If $f$ is proper and of finite presentation
then there exists a universal flattening $S' \to S$ of $X$.
\end{enumerate}
\end{lemma}

\begin{proof}
These statements follow immediately from
Theorem \ref{theorem-flat-dimension-n-representable}
applied to $F_0 = F_{flat}$
and the fact that if $f$ is proper then $\mathcal{F}$ is automatically
pure over the base, see
Lemma \ref{lemma-proper-pure}.
\end{proof}







\section{Grothendieck's Existence Theorem, IV}
\label{section-existence}

\noindent
This section continues the discussion in
Cohomology of Schemes, Sections \ref{coherent-section-existence},
\ref{coherent-section-existence-proper}, and
\ref{coherent-section-existence-proper-support}.
We will work in the following situation.

\begin{situation}
\label{situation-existence}
Here we have an inverse system of rings $(A_n)$ with surjective transition
maps whose kernels are locally nilpotent. Set $A = \lim A_n$. We have a
scheme $X$ separated and of finite presentation over $A$.
We set $X_n = X \times_{\Spec(A)} \Spec(A_n)$ and we
view it as a closed subscheme of $X$. We assume further given a system
$(\mathcal{F}_n, \varphi_n)$ where $\mathcal{F}_n$ is a finitely presented
$\mathcal{O}_{X_n}$-module, flat over $A_n$, with support proper over $A_n$,
and
$$
\varphi_n :
\mathcal{F}_n \otimes_{\mathcal{O}_{X_n}} \mathcal{O}_{X_{n - 1}}
\longrightarrow
\mathcal{F}_{n - 1}
$$
is an isomorphism (notation using the equivalence of
Morphisms, Lemma \ref{morphisms-lemma-i-star-equivalence}).
\end{situation}

\noindent
Our goal is to see if we can find a quasi-coherent sheaf $\mathcal{F}$
on $X$ such that
$\mathcal{F}_n = \mathcal{F} \otimes_{\mathcal{O}_X} \mathcal{O}_{X_n}$
for all $n$.

\begin{lemma}
\label{lemma-compute-what-it-should-be}
In Situation \ref{situation-existence} consider
$$
K = R\lim_{D_\QCoh(\mathcal{O}_X)}(\mathcal{F}_n) =
DQ_X(R\lim_{D(\mathcal{O}_X)}\mathcal{F}_n)
$$
Then $K$ is in $D^b_{\QCoh}(\mathcal{O}_X)$ and in fact
$K$ has nonzero cohomology sheaves only in degrees $\geq 0$.
\end{lemma}

\begin{proof}
Special case of
Derived Categories of Schemes, Example
\ref{perfect-example-inverse-limit-quasi-coherent}.
\end{proof}

\begin{lemma}
\label{lemma-compute-against-perfect}
In Situation \ref{situation-existence} let $K$ be as in
Lemma \ref{lemma-compute-what-it-should-be}. For any perfect
object $E$ of $D(\mathcal{O}_X)$ we have
\begin{enumerate}
\item $M = R\Gamma(X, K \otimes^\mathbf{L} E)$ is a perfect object of $D(A)$
and there is a canonical isomorphism
$R\Gamma(X_n, \mathcal{F}_n \otimes^\mathbf{L} E|_{X_n}) =
M \otimes_A^\mathbf{L} A_n$
in $D(A_n)$,
\item $N = R\Hom_X(E, K)$ is a perfect object of $D(A)$
and there is a canonical isomorphism
$R\Hom_{X_n}(E|_{X_n}, \mathcal{F}_n) = N \otimes_A^\mathbf{L} A_n$
in $D(A_n)$.
\end{enumerate}
In both statements $E|_{X_n}$ denotes the derived pullback
of $E$ to $X_n$.
\end{lemma}

\begin{proof}
Proof of (2). Write $E_n = E|_{X_n}$ and
$N_n = R\Hom_{X_n}(E_n, \mathcal{F}_n)$.
Recall that $R\Hom_{X_n}(-, -)$ is equal to
$R\Gamma(X_n, R\SheafHom(-, -))$, see
Cohomology, Section \ref{cohomology-section-global-RHom}.
Hence by Derived Categories of Schemes, Lemma
\ref{perfect-lemma-base-change-RHom-perfect}
we see that $N_n$ is a perfect object of $D(A_n)$
whose formation commutes with base change. Thus the maps
$N_n \otimes_{A_n}^\mathbf{L} A_{n - 1} \to N_{n - 1}$
coming from $\varphi_n$ are isomorphisms.
By More on Algebra, Lemma \ref{more-algebra-lemma-Rlim-perfect-gives-perfect}
we find that $R\lim N_n$ is perfect and
that its base change back to $A_n$ recovers $N_n$.
On the other hand, the exact functor
$R\Hom_X(E, -) : D_\QCoh(\mathcal{O}_X) \to D(A)$
of triangulated categories commutes with products
and hence with derived limits, whence
$$
R\Hom_X(E, K) =
R\lim R\Hom_X(E, \mathcal{F}_n) =
R\lim R\Hom_X(E_n, \mathcal{F}_n) =
R\lim N_n
$$
This proves (2). To see that (1) holds, translate it into (2)
using Cohomology, Lemma \ref{cohomology-lemma-dual-perfect-complex}.
\end{proof}

\begin{lemma}
\label{lemma-relative-pseudo-coherence}
In Situation \ref{situation-existence} let $K$ be as in
Lemma \ref{lemma-compute-what-it-should-be}. Then $K$
is pseudo-coherent relative to $A$.
\end{lemma}

\begin{proof}
Combinging Lemma \ref{lemma-compute-against-perfect} and
Derived Categories of Schemes, Lemma \ref{perfect-lemma-perfect-enough}
we see that $R\Gamma(X, K \otimes^\mathbf{L} E)$
is pseudo-coherent in $D(A)$ for all pseudo-coherent
$E$ in $D(\mathcal{O}_X)$. Thus the lemma follows from
More on Morphisms, Lemma
\ref{more-morphisms-lemma-characterize-pseudo-coherent}.
\end{proof}

\begin{lemma}
\label{lemma-compute-over-affine}
In Situation \ref{situation-existence} let $K$ be as in
Lemma \ref{lemma-compute-what-it-should-be}. For any quasi-compact
open $U \subset X$ we have
$$
R\Gamma(U, K) \otimes_A^\mathbf{L} A_n =
R\Gamma(U_n, \mathcal{F}_n)
$$
in $D(A_n)$ where $U_n = U \cap X_n$.
\end{lemma}

\begin{proof}
Fix $n$. By Derived Categories of Schemes, Lemma
\ref{perfect-lemma-computing-sections-as-colim}
there exists a system of perfect complexes $E_m$
on $X$ such that
$R\Gamma(U, K) = \text{hocolim} R\Gamma(X, K \otimes^\mathbf{L} E_m)$.
In fact, this formula holds not just for $K$ but for every object of
$D_\QCoh(\mathcal{O}_X)$.
Applying this to $\mathcal{F}_n$
we obtain
\begin{align*}
R\Gamma(U_n, \mathcal{F}_n)
& =
R\Gamma(U, \mathcal{F}_n) \\
& =
\text{hocolim}_m R\Gamma(X, \mathcal{F}_n \otimes^\mathbf{L} E_m) \\
& =
\text{hocolim}_m R\Gamma(X_n, \mathcal{F}_n \otimes^\mathbf{L} E_m|_{X_n})
\end{align*}
Using Lemma \ref{lemma-compute-against-perfect}
and the fact that $- \otimes_A^\mathbf{L} A_n$
commutes with homotopy colimits we obtain the result.
\end{proof}

\begin{lemma}
\label{lemma-finitely-presented}
In Situation \ref{situation-existence} let $K$ be as in
Lemma \ref{lemma-compute-what-it-should-be}.
Denote $X_0 \subset X$ the closed subset
consisting of points lying over the closed subset
$\Spec(A_1) = \Spec(A_2) = \ldots$ of $\Spec(A)$.
There exists an open $W \subset X$ containing $X_0$
such that
\begin{enumerate}
\item $H^i(K)|_W$ is zero unless $i = 0$,
\item $\mathcal{F} = H^0(K)|_W$ is of finite presentation, and
\item $\mathcal{F}_n = \mathcal{F} \otimes_{\mathcal{O}_X} \mathcal{O}_{X_n}$.
\end{enumerate}
\end{lemma}

\begin{proof}
Fix $n \geq 1$. By construction there is a canonical map
$K \to \mathcal{F}_n$ in $D_\QCoh(\mathcal{O}_X)$
and hence a canonical map $H^0(K) \to \mathcal{F}_n$
of quasi-coherent sheaves. This explains the meaning of part (3).

\medskip\noindent
Let $x \in X_0$ be a point.
We will find an open neighbourhood $W$
of $x$ such that (1), (2), and (3) are true. Since $X_0$ is quasi-compact
this will prove the lemma. Let $U \subset X$ be an affine open
neighbourhood of $x$. Say $U = \Spec(B)$.
Choose a surjection $P \to B$ with $P$ smooth over $A$.
By Lemma \ref{lemma-relative-pseudo-coherence}
and the definition of relative pseudo-coherence
there exists a bounded above complex $F^\bullet$
of finite free $P$-modules representing
$Ri_*K$ where $i : U \to \Spec(P)$ is the closed
immersion induced by the presentation.
Let $M_n$ be the $B$-module corresponding to $\mathcal{F}_n|_U$.
By Lemma \ref{lemma-compute-over-affine}
$$
H^i(F^\bullet \otimes_A A_n) =
\left\{
\begin{matrix}
0 & \text{if} & i \not = 0 \\
M_n & \text{if} & i = 0
\end{matrix}
\right.
$$
Let $i$ be the maximal index such that $F^i$ is nonzero.
If $i \leq 0$, then (1), (2), and (3) are true.
If not, then $i > 0$ and we see that the rank of the map
$$
F^{i - 1} \to F^i
$$
in the point $x$ is maximal. Hence in an open neighbourhood
of $x$ inside $\Spec(P)$ the rank is maximal. Thus after replacing
$P$ by a principal localization we may assume that the displayed
map is surjective. Since $F^i$ is finite free we may choose
a splitting $F^{i - 1} = F' \oplus F^i$. Then we may
replace $F^\bullet$ by the complex
$$
\ldots \to F^{i - 2} \to F' \to 0 \to \ldots
$$
and we win by induction on $i$.
\end{proof}

\begin{lemma}
\label{lemma-proper-support}
In Situation \ref{situation-existence} let $K$ be as in
Lemma \ref{lemma-compute-what-it-should-be}. Let $W \subset X$
be as in Lemma \ref{lemma-finitely-presented}.
Set $\mathcal{F} = H^0(K)|_W$. Then, after possibly shrinking the open $W$,
the support of $\mathcal{F}$ is proper over $A$.
\end{lemma}

\begin{proof}
Fix $n \geq 1$. Let $I_n = \Ker(A \to A_n)$.
By More on Algebra, Lemma \ref{more-algebra-lemma-limit-henselian}
the pair $(A, I_n)$ is henselian.
Let $Z \subset W$ be the support of $\mathcal{F}$.
This is a closed subset as $\mathcal{F}$ is of finite presentation.
By part (3) of Lemma \ref{lemma-finitely-presented}
we see that $Z \times_{\Spec(A)} \Spec(A_n)$
is equal to the support of $\mathcal{F}_n$ and hence
proper over $\Spec(A/I)$.
By More on Morphisms, Lemma
\ref{more-morphisms-lemma-split-off-proper-part-henselian}
we can write $Z = Z_1 \amalg Z_2$ with $Z_1, Z_2$ open and
closed in $Z$, with $Z_1$ proper
over $A$, and with $Z_1 \times_{\Spec(A)} \Spec(A/I_n)$
equal to the support of $\mathcal{F}_n$.
In other words, $Z_2$ does not meet $X_0$.
Hence after replacing $W$ by $W \setminus Z_2$ we obtain the lemma.
\end{proof}

\begin{lemma}
\label{lemma-monomorphism-isomorphism}
Let $A = \lim A_n$ be a limit of a system of rings
whose transition maps are surjective and with locally nilpotent
kernels. Let $S = \Spec(A)$. Let $T \to S$ be a monomorphism
which is locally of finite type. If $\Spec(A_n) \to S$
factors through $T$ for all $n$, then $T = S$.
\end{lemma}

\begin{proof}
Set $S_n = \Spec(A_n)$. Let $T_0 \subset T$ be the common
image of the factorizations $S_n \to T$. Then $T_0$ is quasi-compact.
Let $T' \subset T$ be a quasi-compact open containing $T_0$.
Then $S_n \to T$ factors through $T'$.
If we can show that $T' = S$, then $T' = T = S$.
Hence we may assume $T$ is quasi-compact.

\medskip\noindent
Assume $T$ is quasi-compact.
In this case $T \to S$ is separated and quasi-finite
(Morphisms, Lemma
\ref{morphisms-lemma-monomorphism-loc-finite-type-loc-quasi-finite}).
Using Zariski's Main Theorem
(in the form of More on Morphisms, Lemma
\ref{more-morphisms-lemma-quasi-finite-separated-pass-through-finite})
we choose a factorization $T \to W \to S$ with $W \to S$ finite
and $T \to W$ an open immersion. Write $W = \Spec(B)$.
The (unique) factorizations $S_n \to T$ may be viewed
as morphisms into $W$ and we obtain
$$
A \longrightarrow B \longrightarrow \lim A_n = A
$$
Consider the morphism $h : S = \Spec(A) \to \Spec(B) = W$ coming
from the arrow on the right. Then
$$
T \times_{W, h} S
$$
is an open subscheme of $S$ containing the image of $S_n \to S$ for all $n$.
To finish the proof it suffices to show that any open $U \subset S$
containing the image of $S_n \to S$ for some $n \geq 1$ is equal to $S$.
This is true because $(A, \Ker(A \to A_n))$ is a henselian pair
(More on Algebra, Lemma \ref{more-algebra-lemma-limit-henselian})
and hence every closed point of $S$ is contained in the image of $S_n \to S$.
\end{proof}

\begin{theorem}[Grothendieck Existence Theorem]
\label{theorem-existence}
In Situation \ref{situation-existence}
there exists a finitely presented $\mathcal{O}_X$-module
$\mathcal{F}$, flat over $A$, with support proper over $A$,
such that
$\mathcal{F}_n = \mathcal{F} \otimes_{\mathcal{O}_X} \mathcal{O}_{X_n}$
for all $n$ compatibly with the maps $\varphi_n$.
\end{theorem}

\begin{proof}
Apply Lemmas \ref{lemma-compute-what-it-should-be},
\ref{lemma-compute-against-perfect},
\ref{lemma-relative-pseudo-coherence},
\ref{lemma-compute-over-affine},
\ref{lemma-finitely-presented}, and
\ref{lemma-proper-support}
to get an open subscheme $W \subset X$ containing all points
lying over $\Spec(A_n)$
and a finitely presented $\mathcal{O}_W$-module $\mathcal{F}$
whose support is proper over $A$ with
$\mathcal{F}_n = \mathcal{F} \otimes_{\mathcal{O}_W} \mathcal{O}_{X_n}$
for all $n \geq 1$. (This makes sense as $X_n \subset W$.)
By Lemma \ref{lemma-proper-pure} we see that $\mathcal{F}$
is universally pure relative to $\Spec(A)$.
By Theorem \ref{theorem-flat-dimension-n-representable}
(for explanation, see Lemma \ref{lemma-when-universal-flattening})
there exists a universal flattening $S' \to \Spec(A)$
of $\mathcal{F}$ and moreover the morphism $S' \to \Spec(A)$
is a monomorphism of finite presentation.
Since the base change of $\mathcal{F}$ to $\Spec(A_n)$
is $\mathcal{F}_n$ we find that $\Spec(A_n) \to \Spec(A)$
factors (uniquely) through $S'$ for each $n$.
By Lemma \ref{lemma-monomorphism-isomorphism}
we see that $S' = \Spec(A)$.
This means that $\mathcal{F}$ is flat over $A$.
Finally, since the scheme theoretic support $Z$ of $\mathcal{F}$
is proper over $\Spec(A)$, the morphism $Z \to X$ is closed.
Hence the pushforward $(W \to X)_*\mathcal{F}$ is supported
on $W$ and has all the desired properties.
\end{proof}






\section{Grothendieck's Existence Theorem, V}
\label{section-existence-derived}

\noindent
In this section we prove an analogue for Grothendieck's existence theorem
in the derived category, following the method used in
Section \ref{section-existence} for quasi-coherent modules.
The classical case is discussed in
Cohomology of Schemes, Sections \ref{coherent-section-existence},
\ref{coherent-section-existence-proper}, and
\ref{coherent-section-existence-proper-support}.
We will work in the following situation.

\begin{situation}
\label{situation-existence-derived}
Here we have an inverse system of rings $(A_n)$ with surjective transition
maps whose kernels are locally nilpotent. Set $A = \lim A_n$. We have a
scheme $X$ proper, flat, and of finite presentation over $A$.
We set $X_n = X \times_{\Spec(A)} \Spec(A_n)$ and we
view it as a closed subscheme of $X$. We assume further given a system
$(K_n, \varphi_n)$ where $K_n$ is a pseudo-coherent object of
$D(\mathcal{O}_{X_n})$ and
$$
\varphi_n : K_n \longrightarrow K_{n - 1}
$$
is a map in $D(\mathcal{O}_{X_n})$ which induces an isomorphism
$K_n \otimes_{\mathcal{O}_{X_n}}^\mathbf{L} \mathcal{O}_{X_{n - 1}}
\to K_{n - 1}$ in $D(\mathcal{O}_{X_{n - 1}})$.
\end{situation}

\noindent
More precisely, we should write
$\varphi_n : K_n \to Ri_{n - 1, *}K_{n - 1}$
where $i_{n - 1} : X_{n - 1} \to X_n$ is the inclusion morphism
and in this notation the condition is that the adjoint
map $Li_{n - 1}^*K_n \to K_{n - 1}$ is an isomorphism.
Our goal is to find a pseudo-coherent $K \in D(\mathcal{O}_X)$
such that $K_n = K \otimes_{\mathcal{O}_X}^\mathbf{L} \mathcal{O}_{X_n}$
for all $n$ (with the same abuse of notation).

\begin{lemma}
\label{lemma-compute-what-it-should-be-derived}
In Situation \ref{situation-existence-derived} consider
$$
K = R\lim_{D_\QCoh(\mathcal{O}_X)}(K_n) =
DQ_X(R\lim_{D(\mathcal{O}_X)} K_n)
$$
Then $K$ is in $D^-_{\QCoh}(\mathcal{O}_X)$.
\end{lemma}

\begin{proof}
The functor $DQ_X$ exists because $X$ is quasi-compact and
quasi-separated, see Derived Categories of Schemes, Lemma
\ref{perfect-lemma-better-coherator}.
Since $DQ_X$ is a right adjoint it commutes with products
and therefore with derived limits. Hence the equality
in the statement of the lemma.

\medskip\noindent
By Derived Categories of Schemes,
Lemma \ref{perfect-lemma-boundedness-better-coherator}
the functor $DQ_X$ has bounded cohomological dimension.
Hence it suffices to show that $R\lim K_n \in D^-(\mathcal{O}_X)$.
To see this, let $U \subset X$ be an affine open.
Then there is a canonical exact sequence
$$
0 \to
R^1\lim H^{m - 1}(U, K_n) \to H^m(U, R\lim K_n) \to
\lim H^m(U, K_n) \to 0
$$
by Cohomology, Lemma \ref{cohomology-lemma-RGamma-commutes-with-Rlim}.
Since $U$ is affine and $K_n$ is pseudo-coherent (and hence has
quasi-coherent cohomology sheaves by
Derived Categories of Schemes, Lemma \ref{perfect-lemma-pseudo-coherent})
we see that $H^m(U, K_n) = H^m(K_n)(U)$ by
Derived Categories of Schemes, Lemma
\ref{perfect-lemma-affine-compare-bounded}.
Thus we conclude that it suffices to show that $K_n$
is bounded above independent of $n$.

\medskip\noindent
Since $K_n$ is pseudo-coherent we have $K_n \in D^-(\mathcal{O}_{X_n})$.
Suppose that $a_n$ is maximal such that $H^{a_n}(K_n)$ is nonzero.
Of course $a_1 \leq a_2 \leq a_3 \leq \ldots$.
Note that $H^{a_n}(K_n)$ is an
$\mathcal{O}_{X_n}$-module of finite presentation
(Cohomology, Lemma \ref{cohomology-lemma-finite-cohomology}).
We have $H^{a_n}(K_{n - 1}) =
H^{a_n}(K_n) \otimes_{\mathcal{O}_{X_n}} \mathcal{O}_{X_{n - 1}}$.
Since $X_{n - 1} \to X_n$ is a thickening, it follows from
Nakayama's lemma (Algebra, Lemma \ref{algebra-lemma-NAK}) that if
$H^{a_n}(K_n) \otimes_{\mathcal{O}_{X_n}} \mathcal{O}_{X_{n - 1}}$
is zero, then $H^{a_n}(K_n)$ is zero too. Thus $a_n = a_{n - 1}$
for all $n$ and we conclude.
\end{proof}

\begin{lemma}
\label{lemma-compute-against-perfect-derived}
In Situation \ref{situation-existence-derived} let $K$ be as in
Lemma \ref{lemma-compute-what-it-should-be-derived}. For any perfect
object $E$ of $D(\mathcal{O}_X)$ the cohomology
$$
M = R\Gamma(X, K \otimes^\mathbf{L} E)
$$
is a pseudo-coherent object of $D(A)$ and there is a canonical isomorphism
$$
R\Gamma(X_n, K_n \otimes^\mathbf{L} E|_{X_n}) = M \otimes_A^\mathbf{L} A_n
$$
in $D(A_n)$. Here $E|_{X_n}$ denotes the derived pullback of $E$ to $X_n$.
\end{lemma}

\begin{proof}
Write $E_n = E|_{X_n}$ and
$M_n = R\Gamma(X_n, K_n \otimes^\mathbf{L} E|_{X_n})$.
By Derived Categories of Schemes, Lemma
\ref{perfect-lemma-flat-proper-pseudo-coherent-direct-image-general}
we see that $M_n$ is a pseudo-coherent object of $D(A_n)$
whose formation commutes with base change. Thus the maps
$M_n \otimes_{A_n}^\mathbf{L} A_{n - 1} \to M_{n - 1}$
coming from $\varphi_n$ are isomorphisms. By
More on Algebra, Lemma
\ref{more-algebra-lemma-Rlim-pseudo-coherent-gives-pseudo-coherent}
we find that $R\lim M_n$ is pseudo-coherent and
that its base change back to $A_n$ recovers $M_n$.
On the other hand, the exact functor
$R\Gamma(X, -) : D_\QCoh(\mathcal{O}_X) \to D(A)$
of triangulated categories commutes with products
and hence with derived limits, whence
$$
R\Gamma(X, E \otimes^\mathbf{L} K) =
R\lim R\Gamma(X,  E \otimes^\mathbf{L} K_n) =
R\lim R\Gamma(X_n, E_n \otimes^\mathbf{L} K_n) =
R\lim M_n
$$
as desired.
\end{proof}

\begin{lemma}
\label{lemma-relative-pseudo-coherence-derived}
In Situation \ref{situation-existence-derived} let $K$ be as in
Lemma \ref{lemma-compute-what-it-should-be-derived}. Then $K$
is pseudo-coherent on $X$.
\end{lemma}

\begin{proof}
Combinging Lemma \ref{lemma-compute-against-perfect-derived} and
Derived Categories of Schemes, Lemma
\ref{perfect-lemma-perfect-enough}
we see that $R\Gamma(X, K \otimes^\mathbf{L} E)$
is pseudo-coherent in $D(A)$ for all pseudo-coherent
$E$ in $D(\mathcal{O}_X)$. Thus it follows from
More on Morphisms, Lemma
\ref{more-morphisms-lemma-characterize-pseudo-coherent}
that $K$ is pseudo-coherent relative to $A$.
Since $X$ is of flat and of finite presentation
over $A$, this is the same as being pseudo-coherent on $X$, see
More on Morphisms, Lemma
\ref{more-morphisms-lemma-check-relative-pseudo-coherence-on-charts}.
\end{proof}

\begin{lemma}
\label{lemma-compute-over-affine-derived}
In Situation \ref{situation-existence-derived} let $K$ be as in
Lemma \ref{lemma-compute-what-it-should-be-derived}. For any quasi-compact
open $U \subset X$ we have
$$
R\Gamma(U, K) \otimes_A^\mathbf{L} A_n =
R\Gamma(U_n, K_n)
$$
in $D(A_n)$ where $U_n = U \cap X_n$.
\end{lemma}

\begin{proof}
Fix $n$. By Derived Categories of Schemes, Lemma
\ref{perfect-lemma-computing-sections-as-colim}
there exists a system of perfect complexes $E_m$
on $X$ such that
$R\Gamma(U, K) = \text{hocolim} R\Gamma(X, K \otimes^\mathbf{L} E_m)$.
In fact, this formula holds not just for $K$ but for every object of
$D_\QCoh(\mathcal{O}_X)$.
Applying this to $K_n$
we obtain
\begin{align*}
R\Gamma(U_n, K_n)
& =
R\Gamma(U, K_n) \\
& =
\text{hocolim}_m R\Gamma(X, K_n \otimes^\mathbf{L} E_m) \\
& =
\text{hocolim}_m R\Gamma(X_n, K_n \otimes^\mathbf{L} E_m|_{X_n})
\end{align*}
Using Lemma \ref{lemma-compute-against-perfect-derived}
and the fact that $- \otimes_A^\mathbf{L} A_n$
commutes with homotopy colimits we obtain the result.
\end{proof}

\begin{theorem}[Derived Grothendieck Existence Theorem]
\label{theorem-existence-derived}
In Situation \ref{situation-existence-derived}
there exists a pseudo-coherent $K$ in $D(\mathcal{O}_X)$
such that $K_n = K \otimes_{\mathcal{O}_X}^\mathbf{L} \mathcal{O}_{X_n}$
for all $n$ compatibly with the maps $\varphi_n$.
\end{theorem}

\begin{proof}
Apply Lemmas \ref{lemma-compute-what-it-should-be-derived},
\ref{lemma-compute-against-perfect-derived},
\ref{lemma-relative-pseudo-coherence-derived}
to get a pseudo-coherent object $K$ of $D(\mathcal{O}_X)$.
Choosing affine opens in Lemma
\ref{lemma-compute-over-affine-derived}
it follows immediately that $K$ restricts to $K_n$ over $X_n$.
\end{proof}

\begin{remark}
\label{remark-correct-generality}
The result in this section can be generalized. It is probably correct
if we only assume $X \to \Spec(A)$ to be separated, of finite presentation,
and $K_n$ pseudo-coherent relative to $A_n$ supported on a closed
subset of $X_n$ proper over $A_n$. The outcome will be a $K$ which
is pseudo-coherent relative to $A$ supported on a closed subset
proper over $A$. If we ever need this, we will
formulate a precise statement and prove it here.
\end{remark}






\section{Blowing up and flatness}
\label{section-blowup-flat}

\noindent
In this section we continue our discussion of results of the form: ``After a
blowup the strict transform becomes flat'', see
More on Algebra, Section \ref{more-algebra-section-blowup-flat} and
Divisors, Section \ref{divisors-section-blowup-flat}.
We will use the following
(more or less standard) notation in this section. If $X \to S$ is
a morphism of schemes, $\mathcal{F}$ is a quasi-coherent module
on $X$, and $T \to S$ is a morphism of schemes, then we denote
$\mathcal{F}_T$ the pullback of $\mathcal{F}$ to the base change
$X_T = X \times_S T$.

\begin{remark}
\label{remark-successive-blowups}
Let $S$ be a quasi-compact and quasi-separated scheme. Let $f : X \to S$
be a morphism of schemes. Let $\mathcal{F}$ be a quasi-coherent module on $X$.
Let $U \subset S$ be a quasi-compact open subscheme. Given a $U$-admissible
blowup $S' \to S$ we denote $X'$ the strict transform of $X$ and $\mathcal{F}'$
the strict transform of $\mathcal{F}$ which we think of as a quasi-coherent
module on $X'$ (via Divisors, Lemma \ref{divisors-lemma-strict-transform}).
Let $P$ be a property of $\mathcal{F}/X/S$ which is stable under strict
transform (as above) for $U$-admissible blowups. The general problem in
this section is: Show (under auxiliary conditions on $\mathcal{F}/X/S$)
there exists a $U$-admissible blowup $S' \to S$
such that the strict transform $\mathcal{F}'/X'/S'$ has $P$.

\medskip\noindent
The general strategy will be to use that a composition of
$U$-admissible blowups is a $U$-admissible blowup, see
Divisors, Lemma \ref{divisors-lemma-composition-admissible-blowups}.
In fact, we will make use of the more precise
Divisors, Lemma \ref{divisors-lemma-composition-finite-type-blowups}
and combine it with
Divisors, Lemma \ref{divisors-lemma-strict-transform-composition-blowups}.
The result is that it suffices to find a sequence of $U$-admissible
blowups
$$
S = S_0 \leftarrow S_1 \leftarrow \ldots \leftarrow S_n
$$
such that, setting $\mathcal{F}_0 = \mathcal{F}$ and $X_0 = X$ and setting
$\mathcal{F}_i/X_i$ equal to the strict transform of
$\mathcal{F}_{i - 1}/X_{i - 1}$, we
arrive at $\mathcal{F}_n/X_n/S_n$ with property $P$.

\medskip\noindent
In particular, choose a finite type quasi-coherent sheaf of ideals
$\mathcal{I} \subset \mathcal{O}_S$ such that $V(\mathcal{I}) = S \setminus U$,
see Properties, Lemma \ref{properties-lemma-quasi-coherent-finite-type-ideals}.
Let $S' \to S$ be the blowup in $\mathcal{I}$ and let $E \subset S'$
be the exceptional divisor (Divisors, Lemma
\ref{divisors-lemma-blowing-up-gives-effective-Cartier-divisor}).
Then we see that we've reduced the
problem to the case where there exists an effective Cartier divisor
$D \subset S$ whose support is $X \setminus U$. In particular we may
assume $U$ is scheme theoretically dense in $S$
(Divisors, Lemma \ref{divisors-lemma-complement-effective-Cartier-divisor}).

\medskip\noindent
Suppose that $P$ is local on $S$: If $S = \bigcup S_i$ is a finite open
covering by quasi-compact opens and $P$ holds for
$\mathcal{F}_{S_i}/X_{S_i}/S_i$ then $P$ holds for $\mathcal{F}/X/S$.
In this case the general problem above is local on $S$ as well, i.e.,
if given $s \in S$ we can find a quasi-compact open neighbourhood $W$ of $s$
such that the problem for $\mathcal{F}_W/X_W/W$ is solvable, then the
problem is solvable for $\mathcal{F}/X/S$. This follows from
Divisors, Lemmas \ref{divisors-lemma-extend-admissible-blowups} and
\ref{divisors-lemma-dominate-admissible-blowups}.
\end{remark}

\begin{lemma}
\label{lemma-helper-blowup-affine-space}
Let $R$ be a ring and let $f \in R$. Let $r\geq 0$ be an integer.
Let $R \to S$ be a ring map and let $M$ be an $S$-module. Assume
\begin{enumerate}
\item $R \to S$ is of finite presentation and flat,
\item every fibre ring $S \otimes_R \kappa(\mathfrak p)$ is
geometrically integral over $R$,
\item $M$ is a finite $S$-module,
\item $M_f$ is a finitely presented $S_f$-module,
\item for all $\mathfrak p \in R$, $f \not \in \mathfrak p$ with
$\mathfrak q = \mathfrak pS$ the module $M_{\mathfrak q}$ is free
of rank $r$ over $S_\mathfrak q$.
\end{enumerate}
Then there exists a finitely generated ideal $I \subset R$ with
$V(f) = V(I)$ such that for all $a \in I$ with $R' = R[\frac{I}{a}]$
the quotient
$$
M' = (M \otimes_R R')/a\text{-power torsion}
$$
over $S' = S \otimes_R R'$ satisfies the following: for every prime
$\mathfrak p' \subset R'$ there exists a $g \in S'$,
$g \not \in \mathfrak p'S'$ such that $M'_g$ is a free $S'_g$-module
of rank $r$.
\end{lemma}

\begin{proof}
This lemma is a generalization of
More on Algebra, Lemma \ref{more-algebra-lemma-blowup-module};
we urge the reader to read that proof first.
Choose a surjection $S^{\oplus n} \to M$, which is possible by (1).
Choose a finite submodule $K \subset \Ker(S^{\oplus n} \to M)$
such that $S^{\oplus n}/K \to M$ becomes an isomorphism after inverting $f$.
This is possible by (4). Set $M_1 = S^{\oplus n}/K$ and suppose we can
prove the lemma for $M_1$. Say $I \subset R$ is the corresponding ideal.
Then for $a \in I$ the map
$$
M_1' = (M_1 \otimes_R R')/a\text{-power torsion}
\longrightarrow
M' = (M \otimes_R R')/a\text{-power torsion}
$$
is surjective. It is also an isomorphism after inverting $a$ in $R'$
as $R'_a = R_f$, see Algebra, Lemma \ref{algebra-lemma-blowup-in-principal}.
But $a$ is a nonzerodivisor on $M'_1$, whence the displayed map is an
isomorphism. Thus it suffices to prove the lemma in case $M$ is a finitely
presented $S$-module.

\medskip\noindent
Assume $M$ is a finitely presented $S$-module satisfying (3).
Then $J = \text{Fit}_r(M) \subset S$ is a finitely generated ideal.
By Lemma \ref{lemma-fibres-irreducible-flat-projective-nonnoetherian}
we can write $S$ as a direct summand of a free
$R$-module: $\bigoplus_{\alpha \in A} R = S \oplus C$.
For any element $h \in S$ writing $h = \sum a_\alpha$ in the
decomposition above, we say that the $a_\alpha$ are the coefficients of $h$.
Let $I' \subset R$ be the ideal of coefficients
of elements of $J$. Multiplication by an element of $S$ defines
an $R$-linear map $S \to S$, hence $I'$ is generated by the coefficients
of the generators of $J$, i.e., $I'$ is a finitely generated ideal.
We claim that $I = fI'$ works.

\medskip\noindent
We first check that $V(f) = V(I)$. The inclusion $V(f) \subset V(I)$ is
clear. Conversely, if $f \not \in \mathfrak p$, then
$\mathfrak q =  \mathfrak p S$ is not an element of $V(J)$ by
property (5) and More on Algebra, Lemma
\ref{more-algebra-lemma-fitting-ideal-generate-locally}.
Hence there is an
element of $J$ which does not map to zero in $S \otimes_R \kappa(\mathfrak p)$.
Thus there exists an element of $I'$ which is not contained in
$\mathfrak p$, so $\mathfrak p \not \in V(fI') = V(I)$.

\medskip\noindent
Let $a \in I$ and set $R' = R[\frac{I}{a}]$. We may write $a = fa'$
for some $a' \in I'$. By Algebra, Lemmas \ref{algebra-lemma-affine-blowup} and
\ref{algebra-lemma-blowup-add-principal} we see that $I' R' = a'R'$
and $a'$ is a nonzerodivisor in $R'$. Set $S' = S \otimes_S R'$.
Every element $g$ of $JS' = \text{Fit}_r(M \otimes_S S')$ can be
written as $g = \sum_\alpha c_\alpha$ for some $c_\alpha \in I'R'$.
Since $I'R' = a'R'$ we can write $c_\alpha = a'c'_\alpha$ for some
$c'_\alpha \in R'$ and $g = (\sum c'_\alpha)a' = g' a'$ in $S'$.
Moreover, there is an $g_0 \in J$ such that $a' = c_\alpha$
for some $\alpha$. For this element we have $g_0 = g'_0 a'$ in $S'$
where $g'_0$ is a unit in $S'$.
Let $\mathfrak p' \subset R'$ be
a prime ideal and $\mathfrak q' = \mathfrak p'S'$.
By the above we see that $JS'_{\mathfrak q'}$ is the
principal ideal generated by the nonzerodivisor $a'$.
It follows from More on Algebra, Lemma
\ref{more-algebra-lemma-principal-fitting-ideal}
that $M'_{\mathfrak q'}$ can be generated by $r$ elements.
Since $M'$ is finite, there exist $m_1, \ldots, m_r \in M'$ and
$g \in S'$, $g \not \in \mathfrak q'$ such that the corresponding map
$(S')^{\oplus r} \to M'$ becomes surjective after inverting $g$.

\medskip\noindent
Finally, consider the ideal $J' = \text{Fit}_{r - 1}(M')$.
Note that $J'S'_g$ is generated by the coefficients of relations between
$m_1, \ldots, m_r$ (compatibility of Fitting ideal with base change).
Thus it suffices to show that $J' = 0$, see
More on Algebra, Lemma
\ref{more-algebra-lemma-fitting-ideal-finite-locally-free}.
Since $R'_a = R_f$ (Algebra, Lemma \ref{algebra-lemma-blowup-in-principal})
and $M'_a = M_f$ we see from (5)
that $J'_a$ maps to zero in $S_{\mathfrak q''}$ for any prime
$\mathfrak q'' \subset S'$ of the form $\mathfrak q'' = \mathfrak p''S'$
where $\mathfrak p'' \subset R'_a$. Since
$S'_a \subset \prod_{\mathfrak q''\text{ as above}} S'_{\mathfrak q''}$
(as $(S'_a)_{\mathfrak p''} \subset S'_{\mathfrak q''}$ by
Lemma \ref{lemma-base-change-universally-flat})
we see that $J'R'_a = 0$. Since $a$ is a nonzerodivisor in $R'$ we
conclude that $J' = 0$ and we win.
\end{proof}

\begin{lemma}
\label{lemma-flatten-module-pre}
Let $S$ be a quasi-compact and quasi-separated scheme.
Let $X \to S$ be a morphism of schemes.
Let $\mathcal{F}$ be a quasi-coherent module on $X$.
Let $U \subset S$ be a quasi-compact open. Assume
\begin{enumerate}
\item $X \to S$ is affine, of finite presentation, flat,
geometrically integral fibres,
\item $\mathcal{F}$ is a module of finite type,
\item $\mathcal{F}_U$ is of finite presentation,
\item $\mathcal{F}$ is flat over $S$ at all generic points of
fibres lying over points of $U$.
\end{enumerate}
Then there exists a $U$-admissible blowup $S' \to S$
and an open subscheme $V \subset X_{S'}$
such that (a) the strict transform $\mathcal{F}'$ of $\mathcal{F}$
restricts to a finitely locally free $\mathcal{O}_V$-module and
(b) $V \to S'$ is surjective.
\end{lemma}

\begin{proof}
Given $\mathcal{F}/X/S$ and $U \subset S$ with hypotheses as
in the lemma, denote $P$ the property ``$\mathcal{F}$ is flat over $S$ at
all generic points of fibres''. It is clear that $P$ is preserved under
strict transform, see
Divisors, Lemma \ref{divisors-lemma-strict-transform-flat}
and Morphisms, Lemma \ref{morphisms-lemma-base-change-module-flat}.
It is also clear that $P$ is local on $S$. Hence any and all observations
of Remark \ref{remark-successive-blowups} apply to the problem posed by
the lemma.

\medskip\noindent
Consider the function $r : U \to \mathbf{Z}_{\geq 0}$ which assigns to
$u \in U$ the integer
$$
r(u) = \dim_{\kappa(\xi_u)}(\mathcal{F}_{\xi_u} \otimes \kappa(\xi_u))
$$
where $\xi_u$ is the generic point of the fibre $X_u$.
By More on Morphisms, Lemma
\ref{more-morphisms-lemma-flat-and-free-at-point-fibre}
and the fact that the image of an open in $X_S$ in $S$ is open,
we see that $r(u)$ is locally constant. Accordingly
$U = U_0 \amalg U_1 \amalg \ldots \amalg U_c$ is a finite disjoint
union of open and closed subschemes where $r$ is constant with value
$i$ on $U_i$. By
Divisors, Lemma \ref{divisors-lemma-separate-disjoint-opens-by-blowing-up}
we can find a $U$-admissible blowup to decompose $S$ into
the disjoint union of two schemes, the first containing $U_0$ and
the second $U_1 \cup \ldots \cup U_c$. Repeating this $c - 1$
more times we may assume that $S$ is a disjoint union
$S = S_0 \amalg S_1 \amalg \ldots \amalg S_c$ with $U_i \subset S_i$.
Thus we may assume the function $r$ defined above is constant, say
with value $r$.

\medskip\noindent
By Remark \ref{remark-successive-blowups} we see that we may assume that
we have an effective Cartier divisor $D \subset S$ whose support is
$S \setminus U$. Another application of Remark \ref{remark-successive-blowups}
combined with
Divisors, Lemma \ref{divisors-lemma-characterize-effective-Cartier-divisor}
tells us we may assume that
$S = \Spec(R)$ and $D = \Spec(R/(f))$ for some nonzerodivisor
$f \in R$. This case is handled by
Lemma \ref{lemma-helper-blowup-affine-space}.
\end{proof}

\begin{lemma}
\label{lemma-trick-fitting-ideal}
Let $A \to C$ be a finite locally free ring map of rank $d$.
Let $h \in C$ be an element such that $C_h$ is \'etale over $A$.
Let $J \subset C$ be an ideal. Set $I = \text{Fit}_0(C/J)$ where we
think of $C/J$ as a finite $A$-module. Then $IC_h = JJ'$ for some ideal
$J' \subset C_h$. If $J$ is finitely generated so are $I$ and $J'$.
\end{lemma}

\begin{proof}
We will use basic properties of Fitting ideals, see
More on Algebra, Lemma \ref{more-algebra-lemma-fitting-ideal-basics}.
Then $IC$ is the Fitting ideal of $C/J \otimes_A C$.
Note that $C \to C \otimes_A C$, $c \mapsto 1 \otimes c$ has a section
(the multiplication map). By assumption $C \to C \otimes_A C$ is \'etale
at every prime in the image of $\Spec(C_h)$ under this section.
Hence the multiplication map $C \otimes_A C_h \to C_h$ is \'etale
in particular flat, see Algebra, Lemma \ref{algebra-lemma-map-between-etale}.
Hence there exists a $C_h$-algebra such that
$C \otimes_A C_h \cong C_h \oplus C'$ as $C_h$-algebras, see
Algebra, Lemma \ref{algebra-lemma-surjective-flat-finitely-presented}.
Thus $(C/J) \otimes_A C_h \cong (C_h/J_h) \oplus C'/I'$ as
$C_h$-modules for some ideal $I' \subset C'$.
Hence $IC_h = JJ'$ with $J' = \text{Fit}_0(C'/I')$ where we view
$C'/J'$ as a $C_h$-module.
\end{proof}

\begin{lemma}
\label{lemma-push-ideal}
Let $A \to B$ be an \'etale ring map. Let $a \in A$ be a nonzerodivisor.
Let $J \subset B$ be a finite type ideal with $V(J) \subset V(aB)$.
For every $\mathfrak q \subset B$ there exists a finite type ideal
$I \subset A$ with $V(I) \subset V(a)$ and
$g \in B$, $g \not \in \mathfrak q$ such that
$IB_g = JJ'$ for some finite type ideal $J' \subset B_g$.
\end{lemma}

\begin{proof}
We may replace $B$ by a principal localization at
an element $g \in B$, $g \not \in \mathfrak q$. Thus we may assume
that $B$ is standard \'etale, see
Algebra, Proposition \ref{algebra-proposition-etale-locally-standard}.
Thus we may assume $B$ is a localization
of $C = A[x]/(f)$ for some monic $f \in A[x]$ of some degree $d$.
Say $B = C_h$ for some $h \in C$. Choose elements $h_1, \ldots, h_n \in C$
which generate $J$
over $B$. The condition $V(J) \subset V(aB)$ signifies that
$a^m = \sum b_i h_i$ in $B$ for some large $m$. Set $h_{n + 1} = a^m$.
As in Lemma \ref{lemma-trick-fitting-ideal} we take
$I = \text{Fit}_0(C/(h_1, \ldots, h_{r + 1}))$.
Since the module $C/(h_1, \ldots, h_{r + 1})$
is annihilated by $a^m$ we see that $a^{dm} \in I$ which implies
that $V(I) \subset V(a)$.
\end{proof}

\begin{lemma}
\label{lemma-flatten-module-etale-localize}
Let $S$ be a quasi-compact and quasi-separated scheme.
Let $X \to S$ be a morphism of schemes.
Let $\mathcal{F}$ be a quasi-coherent module on $X$.
Let $U \subset S$ be a quasi-compact open.
Assume there exist finitely many commutative diagrams
$$
\xymatrix{
& X_i \ar[r]_{j_i} \ar[d] & X \ar[d] \\
S_i^* \ar[r] & S_i \ar[r]^{e_i} & S
}
$$
where
\begin{enumerate}
\item $e_i : S_i \to S$ are quasi-compact \'etale morphisms and
$S = \bigcup e_i(S_i)$,
\item $j_i : X_i \to X$ are \'etale morphisms and
$X = \bigcup j_i(X_i)$,
\item $S^*_i \to S_i$ is an $e_i^{-1}(U)$-admissible blowup
such that the strict transform $\mathcal{F}_i^*$ of $j_i^*\mathcal{F}$
is flat over $S^*_i$.
\end{enumerate}
Then there exists a $U$-admissible blowup $S' \to S$ such that
the strict transform of $\mathcal{F}$ is flat over $S'$.
\end{lemma}

\begin{proof}
We claim that the hypotheses of the lemma are preserved under $U$-admissible
blowups. Namely, suppose $b : S' \to S$ is a $U$-admissible blowup in
the quasi-coherent sheaf of ideals $\mathcal{I}$. Moreover, let $S^*_i \to S_i$
be the blowup in the quasi-coherent sheaf of ideals $\mathcal{J}_i$.
Then the collection of morphisms $e'_i : S'_i = S_i \times_S S' \to S'$
and $j'_i : X_i' = X_i \times_S S' \to X \times_S S'$ satisfy conditions
(1), (2), (3) for the strict transform $\mathcal{F}'$ of $\mathcal{F}$
relative to the blowup $S' \to S$. First, observe that $S_i'$ is the
blowup of $S_i$ in the pullback of $\mathcal{I}$, see
Divisors, Lemma \ref{divisors-lemma-flat-base-change-blowing-up}.
Second, consider the blowup
$S_i^{\prime *} \to S_i'$ of $S_i'$ in the pullback of the ideal
$\mathcal{J}_i$.
By Divisors, Lemma \ref{divisors-lemma-blowing-up-two-ideals}
we get a commutative diagram
$$
\xymatrix{
S_i^{\prime *} \ar[r] \ar[rd] \ar[d] & S'_i \ar[d] \\
S_i^* \ar[r] & S_i
}
$$
and all the morphisms in the diagram above are blowups. Hence by
Divisors, Lemmas \ref{divisors-lemma-strict-transform-flat} and
\ref{divisors-lemma-strict-transform-composition-blowups}
we see
\begin{align*}
& \text{ the strict transform of }(j'_i)^*\mathcal{F}'\text{ under }
S_i^{\prime *} \to S_i' \\
= &
\text{ the strict transform of }j_i^*\mathcal{F}\text{ under }
S_i^{\prime *} \to S_i \\
= &
\text{ the strict transform of }\mathcal{F}_i'\text{ under }
S_i^{\prime *} \to S_i' \\
= &
\text{ the pullback of }\mathcal{F}_i^*\text{ via }
X_i \times_{S_i} S_i^{\prime *} \to X_i
\end{align*}
which is therefore flat over $S_i^{\prime *}$
(Morphisms, Lemma \ref{morphisms-lemma-base-change-module-flat}).
Having said this, we see that all observations of
Remark \ref{remark-successive-blowups} apply to the
problem of finding a $U$-admissible blowup such that the
strict transform of $\mathcal{F}$ becomes flat over the base
under assumptions as in the lemma. In particular, we may assume
that $S \setminus U$ is the support of an effective Cartier divisor
$D \subset S$. Another application of Remark \ref{remark-successive-blowups}
combined with
Divisors, Lemma \ref{divisors-lemma-characterize-effective-Cartier-divisor}
shows we may assume that $S = \Spec(A)$ and $D = \Spec(A/(a))$
for some nonzerodivisor $a \in A$.

\medskip\noindent
Pick an $i$ and $s \in S_i$. Lemma \ref{lemma-push-ideal}
implies we can find an open neighbourhood $s \in W_i \subset S_i$
and a finite type quasi-coherent ideal $\mathcal{I} \subset \mathcal{O}_S$
such that $\mathcal{I} \cdot \mathcal{O}_{W_i} = \mathcal{J}_i \mathcal{J}'_i$
for some finite type quasi-coherent ideal
$\mathcal{J}'_i \subset \mathcal{O}_{W_i}$
and such that $V(\mathcal{I}) \subset V(a) = S \setminus U$.
Since $S_i$ is quasi-compact we can replace $S_i$ by a finite collection
$W_1, \ldots, W_n$ of these opens and assume that for each $i$ there exists
a quasi-coherent sheaf of ideals $\mathcal{I}_i \subset \mathcal{O}_S$ such
that $\mathcal{I}_i \cdot \mathcal{O}_{S_i} = \mathcal{J}_i \mathcal{J}'_i$
for some finite type quasi-coherent ideal
$\mathcal{J}'_i \subset \mathcal{O}_{S_i}$.
As in the discussion of the first paragraph of the proof, consider the
blowup $S'$ of $S$ in the product $\mathcal{I}_1 \ldots \mathcal{I}_n$
(this blowup is $U$-admissible by construction). The base change of $S' \to S$
to $S_i$ is the blowup in
$$
\mathcal{J}_i \cdot
\mathcal{J}'_i \mathcal{I}_1 \ldots \hat{\mathcal{I}_i} \ldots \mathcal{I}_n
$$
which factors through the given blowup $S_i^* \to S_i$
(Divisors, Lemma \ref{divisors-lemma-blowing-up-two-ideals}). In the notation
of the diagram above this means that $S_i^{\prime *} = S_i'$. Hence
after replacing $S$ by $S'$ we arrive in the situation that
$j_i^*\mathcal{F}$ is flat over $S_i$. Hence $j_i^*\mathcal{F}$ is flat
over $S$, see
Lemma \ref{lemma-etale-flat-up-down}.
By Morphisms, Lemma \ref{morphisms-lemma-flat-permanence}
we see that $\mathcal{F}$ is flat over $S$.
\end{proof}

\begin{theorem}
\label{theorem-flatten-module}
Let $S$ be a quasi-compact and quasi-separated scheme.
Let $X$ be a scheme over $S$.
Let $\mathcal{F}$ be a quasi-coherent module on $X$.
Let $U \subset S$ be a quasi-compact open. Assume
\begin{enumerate}
\item $X$ is quasi-compact,
\item $X$ is locally of finite presentation over $S$,
\item $\mathcal{F}$ is a module of finite type,
\item $\mathcal{F}_U$ is of finite presentation, and
\item $\mathcal{F}_U$ is flat over $U$.
\end{enumerate}
Then there exists a $U$-admissible blowup $S' \to S$ such that the
strict transform $\mathcal{F}'$ of $\mathcal{F}$ is an
$\mathcal{O}_{X \times_S S'}$-module of finite presentation and
flat over $S'$.
\end{theorem}

\begin{proof}
We first prove that we can find a $U$-admissible blowup such that the
strict transform is flat. The question is \'etale local on the source
and the target, see
Lemma \ref{lemma-flatten-module-etale-localize} for a precise statement.
In particular, we may assume that $S = \Spec(R)$ and $X = \Spec(A)$
are affine. For $s \in S$ write $\mathcal{F}_s = \mathcal{F}|_{X_s}$
(pullback of $\mathcal{F}$ to the fibre). As $X \to S$ is of finite type
$d = \max_{s \in S} \dim(\text{Supp}(\mathcal{F}_s))$
is an integer. We will do induction on $d$.

\medskip\noindent
Let $x \in X$ be a point of $X$ lying over $s \in S$ with
$\dim_x(\text{Supp}(\mathcal{F}_s)) = d$.
Apply Lemma \ref{lemma-elementary-devissage} to get
$g : X' \to X$, $e : S' \to S$, $i : Z' \to X'$, and $\pi : Z' \to Y'$.
Observe that $Y' \to S'$ is
a smooth morphism of affines with geometrically irreducible fibres
of dimension $d$. Because the problem is \'etale local it suffices
to prove the theorem for $g^*\mathcal{F}/X'/S'$. Because $i : Z' \to X'$
is a closed immersion of finite presentation (and since strict transform
commutes with affine pushforward, see
Divisors, Lemma \ref{divisors-lemma-strict-transform-affine})
it suffices to prove the flattening result for $\mathcal{G}$.
Since $\pi$ is finite (hence also affine) it suffices to prove the
flattening result for $\pi_*\mathcal{G}/Y'/S'$. Thus we may assume
that $X \to S$ is a smooth morphism of affines with geometrically
irreducible fibres of dimension $d$.

\medskip\noindent
Next, we apply a blowup as in Lemma \ref{lemma-flatten-module-pre}.
Doing so we reach the situation where there exists an
open $V \subset X$ surjecting onto $S$ such that $\mathcal{F}|_V$
is finite locally free. Let $\xi \in X$ be the generic point of $X_s$. Let
$r = \dim_{\kappa(\xi)} \mathcal{F}_\xi \otimes \kappa(\xi)$.
Choose a map $\alpha : \mathcal{O}_X^{\oplus r} \to \mathcal{F}$
which induces an isomorphism
$\kappa(\xi)^{\oplus r} \to \mathcal{F}_\xi \otimes \kappa(\xi)$.
Because $\mathcal{F}$ is locally free over $V$ we find an open neighbourhood
$W$ of $\xi$ where $\alpha$ is an isomorphism. Shrink $S$ to an affine open
neighbourhood of $s$ such that $W \to S$ is surjective. Say $\mathcal{F}$
is the quasi-coherent module associated to the $A$-module $N$. Since
$\mathcal{F}$ is flat over $S$ at all generic points of fibres
(in fact at all points of $W$), we see that
$$
\alpha_\mathfrak p : A_\mathfrak p^{\oplus r} \to N_\mathfrak p
$$
is universally injective for all primes $\mathfrak p$ of $R$, see
Lemma \ref{lemma-induction-step}. Hence $\alpha$ is universally injective,
see Algebra, Lemma \ref{algebra-lemma-universally-injective-check-stalks}.
Set $\mathcal{H} = \Coker(\alpha)$.
By Divisors, Lemma \ref{divisors-lemma-strict-transform-universally-injective}
we see that, given a $U$-admissible blowup $S' \to S$
the strict transforms of $\mathcal{F}'$ and $\mathcal{H}'$
fit into an exact sequence
$$
0 \to \mathcal{O}_{X \times_S S'}^{\oplus r} \to \mathcal{F}'
\to \mathcal{H}' \to 0
$$
Hence Lemma \ref{lemma-induction-step} also shows that $\mathcal{F}'$
is flat at a point $x'$ if and only if
$\mathcal{H}'$ is flat at that point. In particular $\mathcal{H}_U$ is
flat over $U$ and $\mathcal{H}_U$ is a module of finite presentation.
We may apply the induction hypothesis to $\mathcal{H}$ to see that
there exists a $U$-admissible blowup such that the strict transform
$\mathcal{H}'$ is flat as desired.

\medskip\noindent
To finish the proof of the theorem we still have to show that $\mathcal{F}'$
is a module of finite presentation (after possibly another
$U$-admissible blowup). This follows from
Lemma \ref{lemma-flat-finite-type-finitely-presented-over-dense-open}
as we can assume $U \subset S$ is scheme theoretically dense (see
third paragraph of Remark \ref{remark-successive-blowups}).
This finishes the proof of the theorem.
\end{proof}





\section{Applications}
\label{section-applications}

\noindent
In this section we apply some of the results above.

\begin{lemma}
\label{lemma-flat-after-blowing-up}
Let $S$ be a quasi-compact and quasi-separated scheme.
Let $X$ be a scheme over $S$.
Let $U \subset S$ be a quasi-compact open.
Assume
\begin{enumerate}
\item $X \to S$ is of finite type and quasi-separated, and
\item $X_U \to U$ is flat and locally of finite presentation.
\end{enumerate}
Then there exists a $U$-admissible blowup $S' \to S$ such that
the strict transform of $X$ is flat and of finite presentation
over $S'$.
\end{lemma}

\begin{proof}
Since $X \to S$ is quasi-compact and quasi-separated by assumption,
the strict transform of $X$ with respect to a blowing up $S' \to S$
is also quasi-compact and quasi-separated. Hence to prove the lemma
it suffices to find a $U$-admissible blowup such that the strict
transform is flat and locally of finite presentation.
Let $X = W_1 \cup \ldots \cup W_n$ be a finite affine open covering.
If we can find a $U$-admissible blowup $S_i \to S$ such that the
strict transform of $W_i$ is flat and locally of finite presentation,
then there exists a $U$-admissible blowing up $S' \to S$ dominating
all $S_i \to S$ which does the job (see
Divisors, Lemma \ref{divisors-lemma-dominate-admissible-blowups};
see also Remark \ref{remark-successive-blowups}).
Hence we may assume $X$ is affine.

\medskip\noindent
Assume $X$ is affine. By
Morphisms, Lemma \ref{morphisms-lemma-quasi-affine-finite-type-over-S}
we can choose an immersion $j : X \to \mathbf{A}^n_S$ over $S$.
Let $V \subset \mathbf{A}^n_S$ be a quasi-compact open subscheme
such that $j$ induces a closed immersion $i : X \to V$ over $S$. Apply
Theorem \ref{theorem-flatten-module}
to $V \to S$ and the quasi-coherent module $i_*\mathcal{O}_X$
to obtain a $U$-admissible blowup $S' \to S$ such that the strict
transform of $i_*\mathcal{O}_X$ is flat over $S'$ and of finite presentation
over $\mathcal{O}_{V \times_S S'}$. Let $X'$ be the strict transform
of $X$ with respect to $S' \to S$. Let $i' : X' \to V \times_S S'$
be the induced morphism.
Since taking strict transform commutes with pushforward along affine
morphisms (Divisors, Lemma \ref{divisors-lemma-strict-transform-affine}),
we see that $i'_*\mathcal{O}_{X'}$ is flat over $S$ and of
finite presentation as a $\mathcal{O}_{V \times_S S'}$-module.
This implies the lemma.
\end{proof}

\begin{lemma}
\label{lemma-finite-after-blowing-up}
Let $S$ be a quasi-compact and quasi-separated scheme.
Let $X$ be a scheme over $S$.
Let $U \subset S$ be a quasi-compact open.
Assume
\begin{enumerate}
\item $X \to S$ is proper, and
\item $X_U \to U$ is finite locally free.
\end{enumerate}
Then there exists a $U$-admissible blowup $S' \to S$ such that
the strict transform of $X$ is finite locally free over $S'$.
\end{lemma}

\begin{proof}
By Lemma \ref{lemma-flat-after-blowing-up} we may assume that
$X \to S$ is flat and of finite presentation. After replacing
$S$ by a $U$-admissible blowup if necessary, we may assume
that $U \subset S$ is scheme theoretically dense. Then $f$ is
finite by Lemma \ref{lemma-proper-flat-finite-over-dense-open}.
Hence $f$ is finite locally free by
Morphisms, Lemma \ref{morphisms-lemma-finite-flat}.
\end{proof}

\begin{lemma}
\label{lemma-zariski-after-blowup}
Let $\varphi : X \to S$ be a separated morphism of finite type with
$S$ quasi-compact and quasi-separated. Let $U \subset S$ be a
quasi-compact open such that $\varphi^{-1}U \to U$ is an isomorphism.
Then there exists a $U$-admissible blowup $S' \to S$ such that
the strict transform $X'$ of $X$ is isomorphic to an open subscheme
of $S'$.
\end{lemma}

\begin{proof}
The discussion in Remark \ref{remark-successive-blowups} applies.
Thus we may do a first $U$-admissible blowup and assume the complement
$S \setminus U$ is the support of an effective Cartier divisor $D$.
In particular $U$ is scheme theoretically dense in $S$.
Next, we do another $U$-admissible blowup to get to the situation where
$X \to S$ is flat and of finite presentation, see
Lemma \ref{lemma-flat-after-blowing-up}.
In this case the result follows from Lemma \ref{lemma-zariski}.
\end{proof}

\noindent
The following lemma says that a proper modification can be dominated
by a blowup.

\begin{lemma}
\label{lemma-dominate-modification-by-blowup}
Let $\varphi : X \to S$ be a proper morphism with
$S$ quasi-compact and quasi-separated. Let $U \subset S$ be a
quasi-compact open such that $\varphi^{-1}U \to U$ is an isomorphism.
Then there exists a $U$-admissible blowup $S' \to S$
which dominates $X$, i.e., such that there exists a factorization
$S' \to X \to S$ of the blowup morphism.
\end{lemma}

\begin{proof}
The discussion in Remark \ref{remark-successive-blowups} applies.
Thus we may do a first $U$-admissible blowup and assume the complement
$S \setminus U$ is the support of an effective Cartier divisor $D$.
In particular $U$ is scheme theoretically dense in $S$.
Choose another $U$-admissible blowup $S' \to S$ such that the strict
transform $X'$ of $X$ is an open subscheme of $S'$, see
Lemma \ref{lemma-zariski-after-blowup}.
Since $X' \to S'$ is proper, and
$U \subset S'$ is dense, we see that $X' = S'$. Some details omitted.
\end{proof}

\begin{lemma}
\label{lemma-get-section-after-blowup}
Let $S$ be a scheme. Let $U \subset W \subset S$ be open subschemes.
Let $f : X \to W$ be a morphism and let $s : U \to X$ be a
morphism such that $f \circ s = \text{id}_U$. Assume
\begin{enumerate}
\item $f$ is proper,
\item $S$ is quasi-compact and quasi-separated, and
\item $U$ and $W$ are quasi-compact.
\end{enumerate}
Then there exists a $U$-admissible blowup $b : S' \to S$ and a morphism
$s' : b^{-1}(W) \to X$ extending $s$ with $f \circ s' = b|_{b^{-1}(W)}$.
\end{lemma}

\begin{proof}
We may and do replace $X$ by the scheme theoretic image of $s$.
Then $X \to W$ is an isomorphism over $U$, see
Morphisms, Lemma
\ref{morphisms-lemma-scheme-theoretic-image-of-partial-section}.
By Lemma \ref{lemma-dominate-modification-by-blowup}
there exists a $U$-admissible blowup $W' \to W$ and an
extension $W' \to X$ of $s$.
We finish the proof by applying
Divisors, Lemma \ref{divisors-lemma-extend-admissible-blowups}
to extend $W' \to W$ to a $U$-admissible blowup of $S$.
\end{proof}









\section{Compactifications}
\label{section-compactify}

\noindent
Let $S$ be a quasi-compact and quasi-separated scheme. We will say a
scheme $X$ over $S$ {\it has a compactification over $S$}
or {\it is compactifyable over $S$} if there exists
a quasi-compact open immersion $X \to \overline{X}$ into a scheme
$\overline{X}$ proper over $S$. If $X$ has a compactification over
$S$, then $X \to S$ is separated and of finite type. It is a theorem of
Nagata, see \cite{Lutkebohmert}, \cite{Conrad-Nagata}, \cite{Nagata-1},
\cite{Nagata-2}, \cite{Nagata-3}, and \cite{Nagata-4},
that the converse is true as well. We will prove this theorem
in the next section, see Theorem \ref{theorem-nagata}.

\medskip\noindent
Let $S$ be a quasi-compact and quasi-separated scheme.
Let $X \to S$ be a separated finite type morphism of schemes. The category
of {\it compactifications of $X$ over $S$} is the category defined
as follows:
\begin{enumerate}
\item Objects are open immersions $j : X \to \overline{X}$ over $S$ with
$\overline{X} \to S$ proper.
\item Morphisms $(j' : X \to \overline{X}') \to (j : X \to \overline{X})$
are morphisms $f : \overline{X}' \to \overline{X}$ of schemes over $S$
such that $f \circ j' = j$.
\end{enumerate}
If $j : X \to \overline{X}$ is a compactification, then $j$ is a
quasi-compact open immersion, see
Schemes, Remark \ref{schemes-remark-quasi-compact-and-quasi-separated}.

\medskip\noindent
{\bf Warning.} We do {\it not} assume compactifications $j : X \to \overline{X}$
to have dense image. Consequently, if $f : \overline{X}' \to \overline{X}$
is a morphism of compactifications, it may not be the case that
$f^{-1}(j(X)) = j'(X)$.

\begin{lemma}
\label{lemma-compactifications-cofiltered}
Let $S$ be a quasi-compact and quasi-separated scheme.
Let $X$ be a compactifyable scheme over $S$.
\begin{enumerate}
\item[(a)] The category of compactifications of $X$ over $S$ is
cofiltered.
\item[(b)] The full subcategory consisting of compactifications
$j : X \to \overline{X}$ such that $j(X)$ is dense and
scheme theoretically dense in $\overline{X}$ is initial
(Categories, Definition \ref{categories-definition-initial}).
\item[(c)] If $f : \overline{X}' \to \overline{X}$ is a morphism
of compactifications of $X$ such that $j'(X)$ is dense in $\overline{X}'$,
then $f^{-1}(j(X)) = j'(X)$.
\end{enumerate}
\end{lemma}

\begin{proof}
To prove part (a) we have to check conditions (1), (2), (3) of
Categories, Definition \ref{categories-definition-codirected}.
Condition (1) holds exactly because we assumed that $X$
is compactifyable.
Let $j_i : X \to \overline{X}_i$, $i = 1, 2$ be two compactifications.
Then we can consider the scheme theoretic image $\overline{X}$
of $(j_1, j_2) : X \to \overline{X}_1 \times_S \overline{X}_2$.
This determines a third compactification $j : X \to \overline{X}$
which dominates both $j_i$:
$$
\xymatrix{
(X, \overline{X}_1) & (X, \overline{X}) \ar[l] \ar[r] & (X, \overline{X}_2)
}
$$
Thus (2) holds. Let $f_1, f_2 : \overline{X}_1 \to \overline{X}_2$
be two morphisms between compactifications
$j_i : X \to \overline{X}_i$, $i = 1, 2$.
Let $\overline{X} \subset \overline{X}_1$ be the equalizer of
$f_1$ and $f_2$. As $\overline{X}_2 \to S$ is separated, we see
that $\overline{X}$ is a closed subscheme of $\overline{X}_1$
and hence proper over $S$. Moreover, we obtain an
open immersion $X \to \overline{X}$ because $f_1|_X = f_2|_X = \text{id}_X$.
The morphism $(X \to \overline{X}) \to (j_1 : X \to \overline{X}_1)$
given by the closed immersion $\overline{X} \to \overline{X}_1$
equalizes $f_1$ and $f_2$ which proves condition (3).

\medskip\noindent
Proof of (b). Let $j : X \to \overline{X}$ be a compactification.
If $\overline{X}'$ denotes the scheme theoretic closure of $X$
in $\overline{X}$, then $X$ is dense and scheme theoretically dense
in $\overline{X}'$ by
Morphisms, Lemma \ref{morphisms-lemma-quasi-compact-immersion}.
This proves the first condition of
Categories, Definition \ref{categories-definition-initial}.
Since we have already shown the category of compactifications
of $X$ is cofiltered, the second condition of
Categories, Definition \ref{categories-definition-initial}
follows from the first (we omit the solution to this
categorical exercise).

\medskip\noindent
Proof of (c). After replacing $\overline{X}'$ with the scheme theoretic
closure of $j'(X)$ (which doesn't change the underlying topological space)
this follows from Morphisms, Lemma
\ref{morphisms-lemma-scheme-theoretic-image-of-partial-section}.
\end{proof}

\noindent
We can also consider the category of all compactifications (for varying $X$).
It turns out that this category, localized at the set of morphisms
which induce an isomorphism on the interior
is equivalent to the category of compactifyable schemes over $S$.

\begin{lemma}
\label{lemma-compactifyable}
Let $S$ be a quasi-compact and quasi-separated scheme. Let $f : X \to Y$
be a morphism of schemes over $S$ with $Y$ separated and of finite type
over $S$ and $X$ compactifyable over $S$. Then $X$ has a compactification
over $Y$.
\end{lemma}

\begin{proof}
Let $j : X \to \overline{X}$ be a compactification of $X$ over $S$.
Then we let $\overline{X}'$ be
the scheme theoretic image of $(j, f) : X \to \overline{X} \times_S Y$.
The morphism $\overline{X}' \to Y$ is proper because
$\overline{X} \times_S Y \to Y$ is proper as a base change of
$\overline{X} \to S$. On the other hand, since $Y$ is separated
over $S$, the morphism $(1, f) : X \to X \times_S Y$ is a closed
immersion (Schemes, Lemma \ref{schemes-lemma-semi-diagonal})
and hence $X \to \overline{X}'$ is an open immersion by Morphisms, Lemma
\ref{morphisms-lemma-scheme-theoretic-image-of-partial-section} applied
to the ``partial section'' $s = (j, f)$ to the projection
$\overline{X} \times_S Y \to \overline{X}$.
\end{proof}

\noindent
Let $S$ be a quasi-compact and quasi-separated scheme.
We define the {\it category of compactifications} to be the category
whose objects are pairs $(X, \overline{X})$ where $\overline{X}$
is a scheme proper over $S$ and $X \subset \overline{X}$ is a
quasi-compact open and whose morphisms
are commutative diagrams
$$
\xymatrix{
X \ar[d] \ar[r]_f & Y \ar[d] \\
\overline{X} \ar[r]^{\overline{f}} & \overline{Y}
}
$$
of morphisms of schemes over $S$.

\begin{lemma}
\label{lemma-right-multiplicative-system}
Let $S$ be a quasi-compact and quasi-separated scheme.
The collection of morphisms
$(u, \overline{u}) : (X', \overline{X}') \to (X, \overline{X})$
such that $u$ is an isomorphism forms a right multiplicative system
(Categories, Definition \ref{categories-definition-multiplicative-system})
of arrows in the category of compactifications.
\end{lemma}

\begin{proof}
Axiom RMS1 is trivial to verify. Let us check RMS2 holds.
Suppose given a diagram
$$
\xymatrix{
& (X', \overline{X}') \ar[d]_{(u, \overline{u})} \\
(Y, \overline{Y}) \ar[r]^{(f, \overline{f})} & (X, \overline{X})
}
$$
with $u : X' \to X$ an isomorphism. Then we let $Y' = Y \times_X X'$
with the projection map $v : Y' \to Y$ (an isomorphism). We also
set $\overline{Y}' = \overline{Y} \times_{\overline{X}} \overline{X}'$
with the projection map $\overline{v} : \overline{Y}' \to \overline{Y}$
It is clear that $Y' \to \overline{Y}'$ is an open immersion.
The diagram
$$
\xymatrix{
(Y', \overline{Y}') \ar[r]_{(g, \overline{g})} \ar[d]_{(v, \overline{v})} &
(X', \overline{X}') \ar[d]_{(u, \overline{u})} \\
(Y, \overline{Y}) \ar[r]^{(f, \overline{f})} & (X, \overline{X})
}
$$
shows that axiom RMS2 holds.

\medskip\noindent
Let us check RMS3 holds. Suppose given a pair of morphisms
$(f, \overline{f}), (g, \overline{g}) :
(X, \overline{X}) \to (Y, \overline{Y})$
of compactifications and a morphism
$(v, \overline{v}) : (Y, \overline{Y}) \to (Y', \overline{Y}')$
such that $v$ is an isomorphism and such that
$(v, \overline{v}) \circ (f, \overline{f}) =
(v, \overline{v}) \circ (g, \overline{g})$. Then $f = g$.
Hence if we let $\overline{X}' \subset \overline{X}$
be the equalizer of $\overline{f}$ and $\overline{g}$,
then $(u, \overline{u}) : (X, \overline{X}') \to (X, \overline{X})$
will be a morphism of the category of compactifications
such that $(f, \overline{f}) \circ (u, \overline{u}) =
(g, \overline{g}) \circ (u, \overline{u})$ as desired.
\end{proof}

\begin{lemma}
\label{lemma-invert-right-multiplicative-system}
Let $S$ be a quasi-compact and quasi-separated scheme.
The functor $(X, \overline{X}) \mapsto X$ defines an
equivalence from the category of compactifications localized
(Categories, Lemma \ref{categories-lemma-right-localization})
at the right
multiplicative system of Lemma \ref{lemma-right-multiplicative-system}
to the category of compactifyable schemes over $S$.
\end{lemma}

\begin{proof}
Denote $\mathcal{C}$ the category of compactifications and
denote $Q : \mathcal{C} \to \mathcal{C}'$ the localization
functor of Categories, Lemma
\ref{categories-lemma-properties-right-localization}.
Denote $\mathcal{D}$ the category of compactifyable schemes
over $S$. It is clear from the lemma just cited and our
choice of multiplicative system that we
obtain a functor $\mathcal{C}' \to \mathcal{D}$.
This functor is clearly essentially surjective.
If $f : X \to Y$ is a morphism of compactifyable
schemes, then we choose an open immersion $Y \to \overline{Y}$
into a scheme proper over $S$, and then we choose an embedding
$X \to \overline{X}$ into a scheme $\overline{X}$ proper over
$\overline{Y}$ (possible by Lemma \ref{lemma-compactifyable}
applied to $X \to \overline{Y}$). This gives a morphism
$(X, \overline{X}) \to (Y, \overline{Y})$ of compactifications
which produces our given morphism $X \to Y$.
Finally, suppose given a pair of morphisms in the
localized category with the same source and target: say
$$
a = ((f, \overline{f}) : (X', \overline{X}') \to (Y, \overline{Y}),
(u, \overline{u}) : (X', \overline{X}') \to (X, \overline{X}))
$$
and
$$
b = ((g, \overline{g}) : (X'', \overline{X}'') \to (Y, \overline{Y}),
(v, \overline{v}) : (X'', \overline{X}'') \to (X, \overline{X}))
$$
which produce the same morphism $X \to Y$ over $S$, in other words
$f \circ u^{-1} = g \circ v^{-1}$. By
Categories, Lemma \ref{categories-lemma-morphisms-right-localization}
we may assume that $(X', \overline{X}') = (X'', \overline{X}'')$
and $(u, \overline{u}) = (v, \overline{v})$. In this case we
can consider the equalizer $\overline{X}''' \subset \overline{X}'$
of $\overline{f}$ and $\overline{g}$. The morphism
$(w, \overline{w}) : (X', \overline{X}''') \to (X', \overline{X}')$ is in
the multiplicative subset and we see that $a = b$ in the localized
category by precomposing with $(w, \overline{w})$.
\end{proof}






\section{Nagata compactification}
\label{section-compactifications}

\noindent
In this section we prove the theorem announced in
Section \ref{section-compactify}.

\begin{lemma}
\label{lemma-check-separated}
Let $X \to S$ be a morphism of schemes. If $X = U \cup V$
is an open cover such that $U \to S$ and $V \to S$ are separated
and $U \cap V \to U \times_S V$ is closed, then
$X \to S$ is separated.
\end{lemma}

\begin{proof}
Omitted. Hint: check that $\Delta : X \to X \times_S X$ is
closed by using the open covering of $X \times_S X$ given by
$U \times_S U$, $U \times_S V$, $V \times_S U$, and $V \times_S V$.
\end{proof}

\begin{lemma}
\label{lemma-separate-disjoint-locally-closed-by-blowing-up}
Let $X$ be a quasi-compact and quasi-separated scheme.
Let $U \subset X$ be a quasi-compact open.
\begin{enumerate}
\item If $Z_1, Z_2 \subset X$ are closed subschemes of finite
presentation such that $Z_1 \cap Z_2 \cap U = \emptyset$, then
there exists a $U$-admissible blowing up $X' \to X$
such that the strict transforms of $Z_1$ and $Z_2$ are disjoint.
\item If $T_1, T_2 \subset U$ are disjoint constructible closed subsets, then
there is a $U$-admissible blowing up $X' \to X$ such that the closures of
$T_1$ and $T_2$ are disjoint.
\end{enumerate}
\end{lemma}

\begin{proof}
Proof of (1). The assumption that $Z_i \to X$ is of finite presentation
signifies that the quasi-coherent ideal sheaf $\mathcal{I}_i$ of $Z_i$
is of finite type, see 
Morphisms, Lemma \ref{morphisms-lemma-closed-immersion-finite-presentation}.
Denote $Z \subset X$ the closed subscheme
cut out by the product $\mathcal{I}_1 \mathcal{I}_2$.
Observe that $Z \cap U$ is the disjoint union
of $Z_1 \cap U$ and $Z_2 \cap U$. By Divisors, Lemma
\ref{divisors-lemma-separate-disjoint-opens-by-blowing-up}
there is a $U \cap Z$-admissible blowup $Z' \to Z$ such that
the strict transforms of $Z_1$ and $Z_2$ are disjoint.
Denote $Y \subset Z$ the center of this blowing up.
Then $Y \to X$ is a closed immersion of finite presentation as the composition
of $Y \to Z$ and $Z \to X$ (Divisors, Definition
\ref{divisors-definition-admissible-blowup}
and Morphisms, Lemma \ref{morphisms-lemma-composition-finite-presentation}).
Thus the blowing up $X' \to X$ of $Y$ is a $U$-admissible blowing
up. By general properties of strict transforms, the
strict transform of $Z_1, Z_2$ with respect to $X' \to X$
is the same as the strict transform of $Z_1, Z_2$ with respect
to $Z' \to Z$, see
Divisors, Lemma \ref{divisors-lemma-strict-transform}.
Thus (1) is proved.

\medskip\noindent
Proof of (2). By Properties, Lemma
\ref{properties-lemma-quasi-coherent-finite-type-ideals}
there exists a finite type quasi-coherent sheaf of ideals
$\mathcal{J}_i \subset \mathcal{O}_U$ such that
$T_i = V(\mathcal{J}_i)$ (set theoretically).
By Properties, Lemma \ref{properties-lemma-extend}
there exists a finite type quasi-coherent sheaf
of ideals $\mathcal{I}_i \subset \mathcal{O}_X$
whose restriction to $U$ is $\mathcal{J}_i$.
Apply the result of part (1) to the closed
subschemes $Z_i = V(\mathcal{I}_i)$ to conclude.
\end{proof}

\begin{lemma}
\label{lemma-blowup-iso-along}
Let $f : X \to Y$ be a proper morphism of quasi-compact and
quasi-separated schemes. Let $V \subset Y$ be a quasi-compact open
and $U = f^{-1}(V)$. Let $T \subset V$ be a closed subset such that
$f|_U : U \to V$ is an isomorphism over an open neighbourhood of $T$
in $V$. Then there exists a $V$-admissible blowing up $Y' \to Y$
such that the strict transform $f' : X' \to Y'$ of $f$
is an isomorphism over an open neighbourhood of the closure
of $T$ in $Y'$.
\end{lemma}

\begin{proof}
Let $T' \subset V$ be the complement of the maximal open over which
$f|_U$ is an isomorphism. Then $T', T$ are closed in $V$ and
$T \cap T' = \emptyset$. Since $V$ is a spectral topological
space, we can find constructible closed subsets $T_c, T'_c$
with $T \subset T_c$, $T' \subset T'_c$ such that
$T_c \cap T'_c = \emptyset$ (choose a quasi-compact
open $W$ of $V$ containing $T'$ not meeting $T$
and set $T_c = V \setminus W$, then choose a quasi-compact
open $W'$ of $V$ containing $T_c$ not meeting $T'$
and set $T'_c = V \setminus W'$).
By Lemma \ref{lemma-separate-disjoint-locally-closed-by-blowing-up}
we may, after replacing $Y$ by a $V$-admissible blowing up,
assume that $T_c$ and $T'_c$ have disjoint closures in $Y$.
Set $Y_0 = Y \setminus \overline{T}'_c$, $V_0 = V \setminus T'_c$,
$U_0 = U \times_V V_0$, and $X_0 = X \times_Y Y_0$.
Since $U_0 \to V_0$ is an isomorphism, we can find a
$V_0$-admissible blowing up $Y'_0 \to Y_0$ such that the
strict transform $X'_0$ of $X_0$ maps isomorphically to $Y'_0$, see
Lemma \ref{lemma-zariski-after-blowup}.
By Divisors, Lemma \ref{divisors-lemma-extend-admissible-blowups}
there exists a $V$-admissible blow up $Y' \to Y$ whose restriction
to $Y_0$ is $Y'_0 \to Y_0$. If $f' : X' \to Y'$ denotes the
strict transform of $f$, then we see what we want is true because
$f'$ restricts to an isomorphism over $Y'_0$.
\end{proof}

\begin{lemma}
\label{lemma-find-common-blowups}
Let $S$ be a quasi-compact and quasi-separated scheme.
Let $U \to X_1$ and $U \to X_2$ be open immersions
of schemes over $S$ and assume $U$, $X_1$, $X_2$ of finite
type and separated over $S$. Then there exists a commutative diagram
$$
\xymatrix{
X_1' \ar[d] \ar[r] & X & X_2' \ar[l] \ar[d] \\
X_1 & U \ar[l] \ar[lu] \ar[u] \ar[ru] \ar[r] & X_2
}
$$
of schemes over $S$ where $X_i' \to X_i$ is a $U$-admissible
blowup, $X_i' \to X$ is an open immersion, and $X$ is separated and finite
type over $S$.
\end{lemma}

\begin{proof}
Throughout the proof all schemes will be separated of finite type over $S$.
This in particular implies these schemes are quasi-compact and quasi-separated
and the morphisms between them are quasi-compact and separated.
See Schemes, Sections \ref{schemes-section-quasi-compact} and
\ref{schemes-section-separation-axioms}.
We will use that if $U \to W$ is an immersion of such schemes over $S$,
then the scheme theoretic image $Z$ of $U$ in $W$ is a closed subscheme
of $W$ and $U \to Z$ is an open immersion, $U \subset Z$ is scheme
theoretically dense, and $U \subset Z$ is dense topologically. See
Morphisms, Lemma
\ref{morphisms-lemma-quasi-compact-immersion}.

\medskip\noindent
Let $X_{12} \subset X_1 \times_S X_2$ be the scheme theoretic image
of $U \to X_1 \times_S X_2$. The projections $p_i : X_{12} \to X_i$
induce isomorphisms $p_i^{-1}(U) \to U$ by
Morphisms, Lemma
\ref{morphisms-lemma-scheme-theoretic-image-of-partial-section}.
Choose a $U$-admissible blowup $X_i^i \to X_i$ such that
the strict transform $X_{12}^i$ of $X_{12}$ is isomorphic to an
open subscheme of $X_i^i$, see
Lemma \ref{lemma-zariski-after-blowup}.
Let $\mathcal{I}_i \subset \mathcal{O}_{X_i}$ be the corresponding
finite type quasi-coherent sheaf of ideals.
Recall that $X_{12}^i \to X_{12}$ is the blowup in
$p_i^{-1}\mathcal{I}_i \mathcal{O}_{X_{12}}$, see
Divisors, Lemma \ref{divisors-lemma-strict-transform}.
Let $X_{12}'$ be the blowup of $X_{12}$ in
$p_1^{-1}\mathcal{I}_1 p_2^{-1}\mathcal{I}_2 \mathcal{O}_{X_{12}}$, see
Divisors, Lemma \ref{divisors-lemma-blowing-up-two-ideals}
for what this entails. We obtain in particular a commutative diagram
$$
\xymatrix{
X_{12}' \ar[d] \ar[r] & X_{12}^2 \ar[d] \\
X_{12}^1 \ar[r] & X_{12}
}
$$
where all the morphisms are $U$-admissible blowing ups.
Since $X_{12}^i \subset X_i^i$ is an open we may choose a $U$-admissible blowup
$X_i' \to X_i^i$ restricting to $X_{12}' \to X_{12}^i$, see
Divisors, Lemma \ref{divisors-lemma-extend-admissible-blowups}.
Then $X_{12}' \subset X_i'$ is an open subscheme and the diagram
$$
\xymatrix{
X_{12}' \ar[d] \ar[r] & X_i' \ar[d] \\
X_{12}^i \ar[r] & X_i^i
}
$$
is commutative with vertical arrows blowing ups and horizontal arrows
open immersions. Note that $X'_{12} \to X_1' \times_S X_2'$ is
an immersion and proper (use that $X'_{12} \to X_{12}$ is proper
and $X_{12} \to X_1 \times_S X_2$ is closed and $X_1' \times_S X_2' \to
X_1 \times_S X_2$ is separated and apply Morphisms, Lemma
\ref{morphisms-lemma-image-proper-scheme-closed}).
Thus $X'_{12} \to  X_1' \times_S X_2'$ is a closed immersion.
It follows that if we define $X$ by glueing $X_1'$ and $X_2'$
along the common open subscheme $X_{12}'$, then $X \to S$ is of finite type
and separated (Lemma \ref{lemma-check-separated}).
As compositions of $U$-admissible blowups are $U$-admissible blowups
(Divisors, Lemma \ref{divisors-lemma-composition-admissible-blowups})
the lemma is proved.
\end{proof}

\begin{lemma}
\label{lemma-replaced-by-strict-transform}
Let $X \to S$ and $Y \to S$ be morphisms of schemes.
Let $U \subset X$ be an open subscheme.
Let $V \to X \times_S Y$ be a quasi-compact morphism
whose composition with the first projection maps into $U$.
Let $Z \subset X \times_S Y$ be the scheme theoretic image of
$V \to X \times_S Y$. Let $X' \to X$ be a $U$-admissible blowup.
Then the scheme theoretic image of $V \to X' \times_S Y$ is the
strict transform of $Z$ with respect to the blowing up.
\end{lemma}

\begin{proof}
Denote $Z' \to Z$ the strict transform. The morphism $Z' \to X'$
induces a morphism $Z' \to X' \times_S Y$ which is a closed immersion
(as $Z'$ is a closed subscheme of $X' \times_X Z$ by definition).
Thus to finish the proof it suffices to show that the scheme theoretic
image $Z''$ of $V \to Z'$ is $Z'$. Observe that $Z'' \subset Z'$
is a closed subscheme such that $V \to Z'$ factors through $Z''$.
Since both $V \to X \times_S Y$ and $V \to X' \times_S Y$ are
quasi-compact (for the latter this follows from Schemes, Lemma
\ref{schemes-lemma-quasi-compact-permanence}
and the fact that $X' \times_S Y \to X \times_S Y$ is separated
as a base change of a proper morphism), by Morphisms, Lemma
\ref{morphisms-lemma-quasi-compact-scheme-theoretic-image}
we see that $Z \cap (U \times_S Y) = Z'' \cap (U \times_S Y)$.
Thus the inclusion morphism $Z'' \to Z'$ is an isomorphism
away from the exceptional divisor $E$ of $Z' \to Z$. However, the
structure sheaf of $Z'$ does not have any nonzero sections supported
on $E$ (by definition of strict transforms) and we conclude that
the surjection $\mathcal{O}_{Z'} \to \mathcal{O}_{Z''}$
must be an isomorphism.
\end{proof}

\begin{lemma}
\label{lemma-compactification-dominates}
Let $S$ be a quasi-compact and quasi-separated scheme. Let $U$ be a
scheme of finite type and separated over $S$. Let $V \subset U$ be a
quasi-compact open. If $V$ has a compactification $V \subset Y$
over $S$, then there exists a $V$-admissible blowing up $Y' \to Y$ and an
open $V \subset V' \subset Y'$ such that $V \to U$
extends to a proper morphism $V' \to U$.
\end{lemma}

\begin{proof}
Consider the scheme theoretic image $Z \subset Y \times_S U$
of the ``diagonal'' morphism $V \to Y \times_S U$. If we replace
$Y$ by a $V$-admissible blowing up, then $Z$ is replaced by
the strict transform with respect to this blowing up, see
Lemma \ref{lemma-replaced-by-strict-transform}. Hence by
Lemma \ref{lemma-zariski-after-blowup} we may assume $Z \to Y$
is an open immersion. If $V' \subset Y$ denotes the image, then we
see that the induced morphism $V' \to U$ is proper because the
projection $Y \times_S U \to U$ is proper and $V' \cong Z$
is a closed subscheme of $Y \times_S U$.
\end{proof}

\noindent
The following lemma is formulated in the Noetherian case only.
The version for quasi-compact and quasi-separated schemes is
true as well, but will be trivially implied by the main
theorem in this section.

\begin{lemma}
\label{lemma-two-compactifications}
Let $S$ be a Noetherian scheme. Let $U$ be a scheme of finite type
and separated over $S$. Let $U = U_1 \cup U_2$ be opens such that
$U_1$ and $U_2$ have compactifications over $S$ and such that
$U_1 \cap U_2$ is dense in $U$. Then $U$ has a compactification over $S$.
\end{lemma}

\begin{proof}
Choose a compactification $U_i \subset X_i$ for $i = 1, 2$. We may
assume $U_i$ is scheme theoretically dense in $X_i$. We may assume there
is an open $V_i \subset X_i$ and a proper morphism
$\psi_i : V_i \to U$ extending $\text{id} : U_i \to U_i$, see
Lemma \ref{lemma-compactification-dominates}. Picture
$$
\xymatrix{
U_i \ar[r] \ar[d] & V_i \ar[r] \ar[dl]^{\psi_i} & X_i \\
U
}
$$
If $\{i, j\} = \{1, 2\}$ denote
$Z_i = U \setminus U_j = U_i \setminus (U_1 \cap U_2)$
and
$Z_j = U \setminus U_i = U_j \setminus (U_1 \cap U_2)$.
Thus we have
$$
U = U_1 \amalg Z_2 = Z_1 \amalg U_2 = Z_1 \amalg (U_1 \cap U_2) \amalg Z_2
$$
Denote $Z_{i, i} \subset V_i$ the inverse image of $Z_i$ under $\psi_i$.
Observe that $\psi_i$ is an isomorphism over an open neighbourhood of $Z_i$.
Denote $Z_{i, j} \subset V_i$ the inverse image of $Z_j$ under $\psi_i$.
Observe that $\psi_i : Z_{i, j} \to Z_j$ is a proper morphism.
Since $Z_i$ and $Z_j$ are disjoint closed subsets of
$U$, we see that $Z_{i, i}$ and $Z_{i, j}$ are disjoint closed subsets
of $V_i$.

\medskip\noindent
Denote $\overline{Z}_{i, i}$ and $\overline{Z}_{i, j}$ the closures of
$Z_{i, i}$ and $Z_{i, j}$ in $X_i$. After replacing $X_i$ by a
$V_i$-admissible blowup we may assume that
$\overline{Z}_{i, i}$ and $\overline{Z}_{i, j}$ are disjoint, see
Lemma \ref{lemma-separate-disjoint-locally-closed-by-blowing-up}.
We assume this holds for both $X_1$ and $X_2$.
Observe that this property is preserved if we replace $X_i$
by a further $V_i$-admissible blowup.

\medskip\noindent
Set $V_{12} = V_1 \times_U V_2$. We have an immersion
$V_{12} \to X_1 \times_S X_2$ which is the composition of the closed
immersion $V_{12} = V_1 \times_U V_2 \to V_1 \times_S V_2$
(Schemes, Lemma \ref{schemes-lemma-fibre-product-after-map})
and the open immersion $V_1 \times_S V_2 \to X_1 \times_S X_2$.
Let $X_{12} \subset X_1 \times_S X_2$ be the scheme theoretic
image of $V_{12} \to X_1 \times_S X_2$. The projection morphisms
$$
p_1 : X_{12} \to X_1
\quad\text{and}\quad
p_2 : X_{12} \to X_2
$$
are proper as $X_1$ and $X_2$ are proper over $S$. If we replace $X_1$ by a
$V_1$-admissible blowing up, then $X_{12}$ is replaced by
the strict transform with respect to this blowing up, see
Lemma \ref{lemma-replaced-by-strict-transform}.

\medskip\noindent
Denote $\psi : V_{12} \to U$ the compositions
$\psi = \psi_1 \circ p_1|_{V_{12}} = \psi_2 \circ p_2|_{V_{12}}$.
Consider the closed subscheme
$$
Z_{12, 2} =
(p_1|_{V_{12}})^{-1}(Z_{1, 2}) =
(p_2|_{V_{12}})^{-1}(Z_{2, 2}) =
\psi^{-1}(Z_2) \subset V_{12}
$$
The morphism $p_1|_{V_{12}} : V_{12} \to V_1$ is an isomorphism
over an open neighbourhood of $Z_{1, 2}$ because $\psi_2 : V_2 \to U$
is an isomorphism over an open neighbourhood of $Z_2$ and
$V_{12} = V_1 \times_U V_2$.
By Lemma \ref{lemma-blowup-iso-along}
there exists a $V_1$-admissible blowing up $X_1' \to X_1$
such that the strict transform $p'_1 : X'_{12} \to X'_1$
of $p_1$ is an isomorphism over an open neighbourhood of
the closure of $Z_{1, 2}$ in $X'_1$.
After replacing $X_1$ by $X'_1$ and $X_{12}$ by $X'_{12}$
we may assume that $p_1$ is an isomorphism over an open
neighbourhood of $\overline{Z}_{1, 2}$.

\medskip\noindent
The reduction of the previous paragraph tells us that
$$
X_{12} \cap (\overline{Z}_{1, 2} \times_S \overline{Z}_{2, 1}) = \emptyset
$$
where the intersection taken in $X_1 \times_S X_2$. Namely, the inverse
image $p_1^{-1}(\overline{Z}_{1, 2})$ in $X_{12}$ maps isomorphically
to $\overline{Z}_{1, 2}$. In particular, we see that $Z_{12, 2}$
is dense in $p_1^{-1}(\overline{Z}_{1, 2})$. Thus $p_2$ maps
$p_1^{-1}(\overline{Z}_{1, 2})$ into $\overline{Z}_{2, 2}$.
Since $\overline{Z}_{2, 2} \cap \overline{Z}_{2, 1} = \emptyset$
we conclude.

\medskip\noindent
Consider the schemes
$$
W_i = U \coprod\nolimits_{U_i} (X_i \setminus \overline{Z}_{i, j}),
\quad i = 1, 2
$$
obtained by glueing. Let us apply Lemma \ref{lemma-check-separated}
to see that $W_i \to S$ is separated. First,
$U \to S$ and $X_i \to S$ are separated. The immersion
$U_i \to U \times_S (X_i \setminus \overline{Z}_{i, j})$
is closed because any specialization $u_i \leadsto u$
with $u_i \in U_i$ and $u \in U \setminus U_i$
can be lifted uniquely to a specialization
$u_i \leadsto v_i$ in $V_i$ along the proper morphism
$\psi_i : V_i \to U$ and then $v_i$ must be in $Z_{i, j}$.
Thus the image of the immersion is closed, whence the immersion
is a closed immersion.

\medskip\noindent
On the other hand, for any valuation ring $A$ over $S$ with fraction field $K$
and any morphism $\gamma : \Spec(K) \to (U_1 \cap U_2)$ over $S$, there
is an $i$ and an extension of $\gamma$ to a morphism $h_i : \Spec(A) \to W_i$.
Namely, for both $i = 1, 2$ there is a morphism
$g_i : \Spec(A) \to X_i$ extending $\gamma$ by the
valuative criterion of properness for $X_i$ over $S$, see
Morphisms, Lemma \ref{morphisms-lemma-characterize-proper}.
Thus we only are in trouble
if $g_i(\mathfrak m_A) \in \overline{Z}_{i, j}$ for $i = 1, 2$. This is
impossible by the emptyness of the intersection of $X_{12}$ and
$\overline{Z}_{1, 2} \times_S \overline{Z}_{2, 1}$ we proved above.

\medskip\noindent
Consider a diagram
$$
\xymatrix{
W_1' \ar[d] \ar[r] & W & W_2' \ar[l] \ar[d] \\
W_1 & U \ar[l] \ar[lu] \ar[u] \ar[ru] \ar[r] & W_2
}
$$
as in Lemma \ref{lemma-find-common-blowups}. By the previous paragraph
for every solid diagram
$$
\xymatrix{
\Spec(K) \ar[r]_\gamma  \ar[d] & W \ar[d] \\
\Spec(A) \ar@{..>}[ru] \ar[r] & S
}
$$
where $\Im(\gamma) \subset U_1 \cap U_2$ there is an $i$ and
an extension $h_i : \Spec(A) \to W_i$ of $\gamma$.
Using the valuative criterion of properness for $W'_i \to W_i$,
we can then lift $h_i$ to $h'_i : \Spec(A) \to W'_i$.
Hence the dotted arrow in the diagram exists. Since $W$
is separated over $S$, we see that the arrow is unique as well.
This implies that $W \to S$ is universally closed by
Morphisms, Lemma
\ref{morphisms-lemma-refined-valuative-criterion-universally-closed}.
As $W \to S$ is already of finite type and separated, we win.
\end{proof}

\begin{theorem}
\label{theorem-nagata}
\begin{reference}
See \cite{Lutkebohmert}, \cite{Conrad-Nagata}, \cite{Nagata-1},
\cite{Nagata-2}, \cite{Nagata-3}, and \cite{Nagata-4}
\end{reference}
Let $S$ be a quasi-compact and quasi-separated scheme. Let
$X \to S$ be a separated, finite type morphism.
Then $X$ has a compactification over $S$.
\end{theorem}

\begin{proof}
We first reduce to the Noetherian case. We strongly urge the reader
to skip this paragraph. There exists a closed immersion
$X \to X'$ with $X' \to S$ of finite presentation and separated.
See Limits, Proposition
\ref{limits-proposition-separated-closed-in-finite-presentation}.
If we find a compactification of $X'$ over $S$, then
taking the scheme theoretic image of $X$ in this will give
a compactification of $X$ over $S$. Thus we may assume
$X \to S$ is separated and of finite presentation.
We may write $S = \lim S_i$ as a directed
limit of a system of Noetherian schemes with affine transition morphisms.
See Limits, Proposition \ref{limits-proposition-approximate}.
We can choose an $i$ and a morphism $X_i \to S_i$ of finite
presentation whose base change to $S$ is $X \to S$, see
Limits, Lemma \ref{limits-lemma-descend-finite-presentation}.
After increasing $i$ we may assume $X_i \to S_i$ is separated, see
Limits, Lemma \ref{limits-lemma-descend-separated-finite-presentation}.
If we can find a compactification of $X_i$ over $S_i$, then the
base change of this to $S$ will be a compactification of $X$ over $S$.
This reduces us to the case discussed in the next paragraph.

\medskip\noindent
Assume $S$ is Noetherian. We can choose a finite affine open covering
$X = \bigcup_{i = 1, \ldots, n} U_i$ such that $U_1 \cap \ldots \cap U_n$
is dense in $X$. This follows from
Properties, Lemma \ref{properties-lemma-point-and-maximal-points-affine}
and the fact that $X$ is quasi-compact with finitely many
irreducible components. For each $i$ we can choose an $n_i \geq 0$ and an
immersion $U_i \to \mathbf{A}^{n_i}_S$ by
Morphisms, Lemma \ref{morphisms-lemma-quasi-affine-finite-type-over-S}.
Hence $U_i$ has a compactification over $S$ for $i = 1, \ldots, n$
by taking the scheme theoretic image in $\mathbf{P}^{n_i}_S$.
Applying Lemma \ref{lemma-two-compactifications}
$(n - 1)$ times we conclude that the theorem is true.
\end{proof}






\section{The h topology}
\label{section-h}

\noindent
For us, loosely speaking, an h sheaf is a sheaf for the Zariski topology
which satisfies the sheaf property for surjective proper morphisms
of finite presentation, see Lemma \ref{lemma-characterize-sheaf-h}.
However, it may be worth pointing out that the definition of the h topology
on the category of schemes depends on the reference.

\medskip\noindent
Voevodsky initially defined an
h covering to be a finite collection of finite type morphisms which are
jointly universally submersive (Morphisms, Definition
\ref{morphisms-definition-submersive}). See \cite[Definition 3.1.2]{Voevodsky}.
This definition works best if the underlying category of schemes is
restricted to all schemes of finite type over a fixed Noetherian base scheme.
In this setting, Voevodsky relates h coverings to ph coverings.
The ph topology is generated by Zariski coverings and proper
surjective morphisms. See Topologies, Section \ref{topologies-section-ph}
for more information.

\medskip\noindent
In Topologies, Section \ref{topologies-section-V} we study the V topology.
A quasi-compact morphism $X \to Y$ defines a V covering, if any specialization
of points of $Y$ is the image of a specialization of points in $X$
and the same is true after any base change
(Topologies, Lemma \ref{topologies-lemma-refine-qcqs-V}).
In this case $X \to Y$ is universally submersive
(Topologies, Lemma \ref{topologies-lemma-V-covering-universally-submersive}).
It turns out the notion of a V covering is a good replacement for
``families of morphisms with fixed target which are
jointly universally submersive'' when working with non-Noetherian schemes.

\medskip\noindent
Our approach will be to first prove the equivalence between ph covers and
V coverings for (possibly infinite) families of morphisms which are
locally of finite presentation. We will then use these families
as our notion of h coverings in the Stacks project.
For Noetherian schemes and finite families these coverings
match those in Voevodsky's definition, see
Lemma \ref{lemma-Noetherian-h-covering}.
On the category of schemes of finite presentation over a fixed
quasi-compact and quasi-separated scheme $S$ these coverings
determine the same topology as the one in \cite[Definition 2.7]{Witt-Grass}.

\begin{lemma}
\label{lemma-equivalence-h-v-locally-finite-presentation}
Let $\{f_i : X_i \to X\}_{i \in I}$ be a family of morphisms
of schemes with fixed target with $f_i$ locally of finite
presentation for all $i$. The following are equivalent
\begin{enumerate}
\item $\{X_i \to X\}$ is a ph covering, and
\item $\{X_i \to X\}$ is a V covering.
\end{enumerate}
\end{lemma}

\begin{proof}
Let $U \subset X$ be affine open. Looking at
Topologies, Definitions \ref{topologies-definition-ph-covering}
and \ref{topologies-definition-V-covering} it suffices to show that
the base change $\{X_i \times_X U \to U\}$ can be refined
by a standard ph covering if and only if it can be refined by
a standard V covering. Thus we may assume $X$ is affine and we have to show
$\{X_i \to X\}$ can be refined by a standard ph covering
if and only if it can be refined by a standard V covering.
Since a standard ph covering is a standard V covering, see
Topologies, Lemma \ref{topologies-lemma-standard-ph-standard-V}
it suffices to prove the other implication.

\medskip\noindent
Assume $X$ is affine and assume $\{f_i : X_i \to X\}_{i \in I}$
can be refined by a standard V covering
$\{g_j : Y_j \to X\}_{j = 1, \ldots, m}$.
For each $j$ choose an $i_j$ and a morphism
$h_j : Y_j \to X_{i_j}$ such that $g_j = f_{i_j} \circ h_j$.
Since $Y_j$ is affine hence quasi-compact,
for each $j$ we can find finitely many affine opens
$U_{j, k} \subset X_{i_j}$ such that $\Im(h_j) \subset \bigcup U_{j, k}$.
Then $\{U_{j, k} \to X\}_{j, k}$ refines $\{X_i \to X\}$
and is a standard V covering (as it is a finite family of morphisms
of affines and it inherits the lifting property for valuation rings
from the corresponding property of $\{Y_j \to X\}$).
Thus we reduce to the case discussed in the next paragraph.

\medskip\noindent
Assume $\{f_i : X_i \to X\}_{i = 1, \ldots, n}$
is a standard V covering with $f_i$ of finite presentation.
We have to show that $\{X_i \to X\}$ can be refined by a standard ph covering.
Choose a generic flatness stratification
$$
X = S \supset S_0 \supset S_1 \supset \ldots \supset S_t = \emptyset
$$
as in More on Morphisms, Lemma
\ref{more-morphisms-lemma-generic-flatness-stratification-scheme}
for the finitely presented morphism
$$
\coprod\nolimits_{i = 1, \ldots, n} f_i :
\coprod\nolimits_{i = 1, \ldots, n} X_i
\longrightarrow
X
$$
of affines. We are going to use all the properties of the stratification
without further mention. By construction the base change of each $f_i$ to
$U_k = S_k \setminus S_{k + 1}$ is flat.
Denote $Y_k$ the scheme theoretic closure of $U_k$ in $S_k$. Since
$U_k \to S_k$ is a quasi-compact open immersion (see
Properties, Lemma \ref{properties-lemma-quasi-coherent-finite-type-ideals}),
we see that $U_k \subset Y_k$ is a quasi-compact dense
(and scheme theoretically dense) open immersion, see
Morphisms, Lemma \ref{morphisms-lemma-quasi-compact-scheme-theoretic-image}.
The morphism $\coprod_{k = 0, \ldots, t - 1} Y_k \to X$
is finite surjective, hence $\{Y_k \to X\}$ is a standard ph covering
and hence a standard V covering (see above). By the transitivity
property of standard V coverings
(Topologies, Lemma \ref{topologies-lemma-composition-standard-V})
it suffices to show that the pullback of
the covering $\{X_i \to X\}$ to each $Y_k$ can be refined by a
standard V covering. This reduces us to the case described in the
next paragraph.

\medskip\noindent
Assume $\{f_i : X_i \to X\}_{i = 1, \ldots, n}$ is a standard V covering
with $f_i$ of finite presentation and there is a dense quasi-compact open
$U \subset X$ such that $X_i \times_X U \to U$ is flat.
By Theorem \ref{theorem-flatten-module}
there is a $U$-admissible blowup $X' \to X$ such that
the strict transform $f'_i : X'_i \to X'$ of $f_i$ is flat.
Observe that the projective (hence closed) morphism $X' \to X$
is surjective as $U \subset X$ is dense and as $U$ is identified
with an open of $X'$. After replacing $X'$ by a further
$U$-admissible blowup if necessary,
we may also assume $U \subset X'$ is scheme theoretically dense
(see Remark \ref{remark-successive-blowups}).
Hence for every point $x \in X'$ there is a valuation ring $V$
and a morphism $g : \Spec(V) \to X'$ such that the generic
point of $\Spec(V)$ maps into $U$ and the closed point of
$\Spec(V)$ maps to $x$, see Morphisms, Lemma
\ref{morphisms-lemma-reach-points-scheme-theoretic-image}.
Since $\{X_i \to X\}$ is a standard V covering, we can choose
an extension of valuation rings $V \subset W$, an index $i$, and a morphism
$\Spec(W) \to X_i$ such that the diagram
$$
\xymatrix{
\Spec(W) \ar[d] \ar[rr] & & X_i \ar[d] \\
\Spec(V) \ar[r] & X' \ar[r] & X
}
$$
is commutative. Since $X'_i \subset X' \times_X X_i$ is a closed subscheme
containing the open $U \times_X X_i$, since $\Spec(W)$ is an integral scheme,
and since the induced morphism $h : \Spec(W) \to X' \times_X X_i$ maps
the generic point of $\Spec(W)$ into $U \times_X X_i$, we conclude
that $h$ factors through the closed subscheme $X'_i \subset X' \times_X X_i$.
We conclude that $\{f'_i : X'_i \to X'\}$ is a V covering.
In particular, $\coprod f'_i$ is surjective. In particular
$\{X'_i \to X'\}$ is an fppf covering. Since an fppf covering is a ph covering
(More on Morphisms, Lemma \ref{more-morphisms-lemma-fppf-ph}),
we can find a standard ph covering $\{Y_j \to X'\}$ refining
$\{X'_i \to X\}$. Say this covering is given by a proper surjective
morphism $Y \to X'$ and a finite affine open covering
$Y = \bigcup Y_j$. Then the composition $Y \to X$ is proper surjective
and we conclude that $\{Y_j \to X\}$ is a standard ph covering.
This finishes the proof.
\end{proof}

\noindent
Here is our definition.

\begin{definition}
\label{definition-h-covering}
Let $T$ be a scheme. A {\it h covering of $T$} is a family of morphisms
$\{f_i : T_i \to T\}_{i \in I}$ such that each $f_i$ is
locally of finite presentation and one of the equivalent conditions of
Lemma \ref{lemma-equivalence-h-v-locally-finite-presentation} is satisfied.
\end{definition}

\noindent
For Noetherian schemes this is the same thing as a ph covering
(we record this in Lemma \ref{lemma-Noetherian-h-ph} below) and
we recover Voevodsky's notion.

\begin{lemma}
\label{lemma-Noetherian-h-covering}
Let $X$ be a Noetherian scheme. Let $\{X_i \to X\}_{i \in I}$
be a finite family of finite type morphisms. The following are equivalent
\begin{enumerate}
\item $\coprod_{i \in I} X_i \to X$ is universally submersive
(Morphisms, Definition
\ref{morphisms-definition-submersive}), and
\item $\{X_i \to X\}_{i \in I}$ is an h covering.
\end{enumerate}
\end{lemma}

\begin{proof}
The implication (2) $\Rightarrow$ (1) follows from the more general
Topologies, Lemma \ref{topologies-lemma-V-covering-universally-submersive}
and our definition of h covers. Assume $\coprod X_i \to X$
is universally submersive. We will show that $\{X_i \to X\}$
can be refined by a ph covering; this will suffice by
Topologies, Lemma \ref{topologies-lemma-refine-by-ph} and
our definition of h coverings.
The argument will be the same as the one used in the proof of
Lemma \ref{lemma-equivalence-h-v-locally-finite-presentation}.

\medskip\noindent
Choose a generic flatness stratification
$$
X = S \supset S_0 \supset S_1 \supset \ldots \supset S_t = \emptyset
$$
as in More on Morphisms, Lemma
\ref{more-morphisms-lemma-generic-flatness-stratification-scheme}
for the finitely presented morphism
$$
\coprod\nolimits_{i = 1, \ldots, n} f_i :
\coprod\nolimits_{i = 1, \ldots, n} X_i
\longrightarrow
X
$$
We are going to use all the properties of the stratification
without further mention. By construction the base change of each
$f_i$ to $U_k = S_k \setminus S_{k + 1}$ is flat.
Denote $Y_k$ the scheme theoretic closure of $U_k$ in $S_k$. Since
$U_k \to S_k$ is a quasi-compact open immersion (all schemes in
this paragraph are Noetherian),
we see that $U_k \subset Y_k$ is a quasi-compact dense
(and scheme theoretically dense) open immersion, see
Morphisms, Lemma \ref{morphisms-lemma-quasi-compact-scheme-theoretic-image}.
The morphism $\coprod_{k = 0, \ldots, t - 1} Y_k \to X$
is finite surjective, hence $\{Y_k \to X\}$ is a ph covering.
By the transitivity property of ph coverings
(Topologies, Lemma \ref{topologies-lemma-ph})
it suffices to show that the pullback of
the covering $\{X_i \to X\}$ to each $Y_k$ can be refined by a
ph covering. This reduces us to the case described in the
next paragraph.

\medskip\noindent
Assume $\coprod X_i \to X$ is universally submersive and
there is a dense open $U \subset X$ such that
$X_i \times_X U \to U$ is flat for all $i$.
By Theorem \ref{theorem-flatten-module}
there is a $U$-admissible blowup $X' \to X$ such that
the strict transform $f'_i : X'_i \to X'$ of $f_i$ is flat for all $i$.
Observe that the projective (hence closed) morphism $X' \to X$
is surjective as $U \subset X$ is dense and as $U$ is identified
with an open of $X'$. After replacing $X'$ by a further
$U$-admissible blowup if necessary, we may also assume $U \subset X'$ is dense
(see Remark \ref{remark-successive-blowups}).
Hence for every point $x \in X'$ there is a discrete valuation ring $A$
and a morphism $g : \Spec(A) \to X'$ such that the generic
point of $\Spec(A)$ maps into $U$ and the closed point of
$\Spec(A)$ maps to $x$, see Limits, Lemma
\ref{limits-lemma-reach-point-closure-Noetherian}.
Set
$$
W = \Spec(A) \times_X \coprod X_i = \coprod \Spec(A) \times_X X_i
$$
Since $\coprod X_i \to X$ is universally submersive,
there is a specialization $w' \leadsto w$ in $W$
such that $w'$ maps to the generic point of $\Spec(A)$
and $w$ maps to the closed point of $\Spec(A)$.
(If not, then the closed fibre of $W \to \Spec(A)$
is stable under generalizations, hence open, which
contradicts the fact that $W \to \Spec(A)$ is submersive.)
Say $w' \in \Spec(A) \times_X X_i$ so of course
$w \in \Spec(A) \times_X X_i$ as well. Let
$x'_i \leadsto x_i$ be the image of $w' \leadsto w$ in
$X' \times_X X_i$. Since $x'_i \in X'_i$ and since
$X'_i \subset X' \times_X X_i$ is a closed subscheme
we see that $x_i \in X'_i$. Since $x_i$ maps to $x \in X'$
we conclude that
$\coprod X'_i \to X'$ is surjective! In particular
$\{X'_i \to X'\}$ is an fppf covering. But an fppf covering is a ph covering
(More on Morphisms, Lemma \ref{more-morphisms-lemma-fppf-ph}).
Since $X' \to X$ is proper surjective, we conclude
that $\{X'_i \to X\}$ is a ph covering and the proof is complete.
\end{proof}

\begin{lemma}
\label{lemma-Noetherian-h-ph}
Let $X$ be a locally Noetherian scheme. A family of morphisms
$\{f_i : X_i \to X\}_{i \in I}$ with target $X$ is an h covering
if and only if it is a ph covering.
\end{lemma}

\begin{proof}
By Definition \ref{definition-h-covering} a h covering is a ph covering.
Conversely, if $\{f_i : X_i \to X\}$ is a ph covering, then the morphisms
$f_i$ are locally of finite type (Topologies, Definition
\ref{topologies-definition-ph-covering}). Since $X$ is locally Noetherian,
each $f_i$ is locally of finite presentation and we see that we have
a h covering by definition.
\end{proof}

\noindent
The following lemma and \cite[Theorem 8.4]{rydh_descent}
shows our definition agrees with (or at least is
closely related to) the definition in the paper \cite{rydh_descent}
by David Rydh. We restrict to affine base for simplicity.

\begin{lemma}
\label{lemma-approximate-h-cover}
Let $X$ be an affine scheme. Let $\{X_i \to X\}_{i \in I}$
be an h covering. Then there exists a surjective proper morphism
$$
Y \longrightarrow X
$$
of finite presentation (!) and a finite affine open covering
$Y = \bigcup_{j = 1, \ldots, m} Y_j$ such that
$\{Y_j \to X\}_{j = 1, \ldots, m}$ refines $\{X_i \to X\}_{i \in I}$.
\end{lemma}

\begin{proof}
By assumption there exists a proper surjective morphism
$Y \to X$ and a finite affine open covering
$Y = \bigcup_{j = 1, \ldots, m} Y_j$ such that
$\{Y_j \to X\}_{j = 1, \ldots, m}$ refines $\{X_i \to X\}_{i \in I}$.
This means that for each $j$ there is an index $i_j \in I$
and a morphism $h_j : Y_j \to X_{i_j}$ over $X$.
See Definition \ref{definition-h-covering} and
Topologies, Definition \ref{topologies-definition-ph-covering}.
The problem is that we don't know that $Y \to X$ is of finite
presentation.
By
Limits, Lemma \ref{limits-lemma-proper-limit-of-proper-finite-presentation}
we can write
$$
Y = \lim Y_\lambda
$$
as a directed limit of schemes $Y_\lambda$ proper and of finite presentation
over $X$ such that the morphisms $Y \to Y_\lambda$ and the
the transition morphisms are closed immersions. Observe that
each $Y_\lambda \to X$ is surjective.
By Limits, Lemma \ref{limits-lemma-descend-opens}
we can find a $\lambda$ and quasi-compact opens
$Y_{\lambda, j} \subset Y_\lambda$, $j = 1, \ldots, m$
covering $Y_\lambda$ and restricting to $Y_j$ in $Y$.
Then $Y_j = \lim Y_{\lambda, j}$.
After increasing $\lambda$ we may assume $Y_{\lambda, j}$
is affine for all $j$, see
Limits, Lemma \ref{limits-lemma-limit-affine}.
Finally, since $X_i \to X$ is locally of finite presentation
we can use the functorial characterization of morphisms
which are locally of finite presentation
(Limits, Proposition
\ref{limits-proposition-characterize-locally-finite-presentation})
to find a $\lambda$ such that for each $j$ there is
a morphism $h_{\lambda, j} : Y_{\lambda, j} \to X_{i_j}$
whose restriction to $Y_j$ is the morphism $h_j$ chosen above.
Thus $\{Y_{\lambda, j} \to X\}$ refines
$\{X_i \to X\}$ and the proof is complete.
\end{proof}

\noindent
We return to the development of the general theory of h coverings.

\begin{lemma}
\label{lemma-zariski-h}
An fppf covering is a h covering. Hence syntomic, smooth, \'etale,
and Zariski coverings are h coverings as well.
\end{lemma}

\begin{proof}
This is true because in an fppf covering the morphisms are
required to be locally of finite presentation and because
fppf coverings are ph covering, see More on Morphisms,
Lemma \ref{more-morphisms-lemma-fppf-ph}.
The second statement follows from the first and
Topologies, Lemma \ref{topologies-lemma-zariski-etale-smooth-syntomic-fppf}.
\end{proof}

\begin{lemma}
\label{lemma-surjective-proper-finite-presentation-h}
Let $f : Y \to X$ be a surjective proper morphism of schemes
which is of finite presentation. Then $\{Y \to X\}$ is an h covering.
\end{lemma}

\begin{proof}
Combine Topologies, Lemmas
\ref{topologies-lemma-zariski-etale-smooth-syntomic-fppf-fpqc-ph-V} and
\ref{topologies-lemma-surjective-proper-ph}.
\end{proof}

\begin{lemma}
\label{lemma-refine-by-h}
Let $T$ be a scheme. Let $\{f_i : T_i \to T\}_{i \in I}$ be a family
of morphisms such that $f_i$ is locally of finite presentation for all $i$.
The following are equivalent
\begin{enumerate}
\item $\{T_i \to T\}_{i \in I}$ is an h covering,
\item there is an h covering which refines $\{T_i \to T\}_{i \in I}$, and
\item $\{\coprod_{i \in I} T_i \to T\}$ is an h covering.
\end{enumerate}
\end{lemma}

\begin{proof}
This follows from the analogous statement for ph coverings
(Topologies, Lemma \ref{topologies-lemma-refine-by-ph})
or from the analogous statement for V coverings
(Topologies, Lemma \ref{topologies-lemma-refine-by-V}).
\end{proof}

\noindent
Next, we show that our notion of an h covering satisfies the conditions of
Sites, Definition \ref{sites-definition-site}.

\begin{lemma}
\label{lemma-h}
Let $T$ be a scheme.
\begin{enumerate}
\item If $T' \to T$ is an isomorphism then $\{T' \to T\}$
is an h covering of $T$.
\item If $\{T_i \to T\}_{i\in I}$ is an h covering and for each
$i$ we have an h covering $\{T_{ij} \to T_i\}_{j\in J_i}$, then
$\{T_{ij} \to T\}_{i \in I, j\in J_i}$ is an h covering.
\item If $\{T_i \to T\}_{i\in I}$ is an h covering
and $T' \to T$ is a morphism of schemes then
$\{T' \times_T T_i \to T'\}_{i\in I}$ is an h covering.
\end{enumerate}
\end{lemma}

\begin{proof}
Follows immediately from the corresponding statement for
either ph or V coverings
(Topologies, Lemma \ref{topologies-lemma-ph} or
\ref{topologies-lemma-V})
and the fact that the class of morphisms which are locally
of finite presentation is preserved under base change and
composition.
\end{proof}

\noindent
Next, we define the big h sites we will work with in the
Stacks project. It makes sense to read the general discussion
in Topologies, Section \ref{topologies-section-procedure}
before proceeding.

\begin{definition}
\label{definition-big-h-site}
A {\it big h site} is any site $\Sch_h$ as in
Sites, Definition \ref{sites-definition-site} constructed as follows:
\begin{enumerate}
\item Choose any set of schemes $S_0$, and any set of h coverings
$\text{Cov}_0$ among these schemes.
\item As underlying category take any category $\Sch_\alpha$
constructed as in Sets, Lemma \ref{sets-lemma-construct-category}
starting with the set $S_0$.
\item Choose any set of coverings as in
Sets, Lemma \ref{sets-lemma-coverings-site} starting with the
category $\Sch_\alpha$ and the class of h coverings,
and the set $\text{Cov}_0$ chosen above.
\end{enumerate}
\end{definition}

\noindent
See the remarks following
Topologies, Definition \ref{topologies-definition-big-zariski-site}
for motivation and explanation regarding the definition of big sites.

\begin{definition}
\label{definition-standard-h}
Let $T$ be an affine scheme. A {\it standard h covering} of $T$
is a family $\{f_i : T_i \to T\}_{i = 1, \ldots, n}$ with each $T_i$
affine, with $f_i$ of finite presentation satisfying either of the
following equivalent conditions: (1) $\{T_i \to T\}$ can be refined by
a standard ph covering or (2) $\{T_i \to T\}$ is a V covering.
\end{definition}

\noindent
The equivalence of the conditions follows from
Lemma \ref{lemma-equivalence-h-v-locally-finite-presentation},
Topologies, Definition \ref{topologies-definition-ph-covering}, and
Lemma \ref{topologies-lemma-refine-by-ph}.

\medskip\noindent
Before we continue with the introduction of the big h site of
a scheme $S$, let us point out that the topology on a big h site
$\Sch_h$ is in some sense induced from the h topology
on the category of all schemes.

\begin{lemma}
\label{lemma-h-induced}
Let $\Sch_h$ be a big h site as in
Definition \ref{definition-big-h-site}.
Let $T \in \Ob(\Sch_h)$.
Let $\{T_i \to T\}_{i \in I}$ be an arbitrary h covering of $T$.
\begin{enumerate}
\item There exists a covering $\{U_j \to T\}_{j \in J}$ of $T$ in the site
$\Sch_h$ which refines $\{T_i \to T\}_{i \in I}$.
\item If $\{T_i \to T\}_{i \in I}$ is a standard h covering, then
it is tautologically equivalent to a covering of $\Sch_h$.
\item If $\{T_i \to T\}_{i \in I}$ is a Zariski covering, then
it is tautologically equivalent to a covering of $\Sch_h$.
\end{enumerate}
\end{lemma}

\begin{proof}
Omitted. Hint: this is exactly the same as the proof of
Topologies, Lemma \ref{topologies-lemma-ph-induced}.
\end{proof}

\begin{definition}
\label{definition-big-small-h}
Let $S$ be a scheme. Let $\Sch_h$ be a big h site containing $S$.
\begin{enumerate}
\item The {\it big h site of $S$}, denoted
$(\Sch/S)_h$, is the site $\Sch_h/S$
introduced in Sites, Section \ref{sites-section-localize}.
\item The {\it big affine h site of $S$}, denoted
$(\textit{Aff}/S)_h$, is the full subcategory of
$(\Sch/S)_h$ whose objects are affine $U/S$.
A covering of $(\textit{Aff}/S)_h$ is any covering
$\{U_i \to U\}$ of $(\Sch/S)_h$ which is a standard h covering.
\end{enumerate}
\end{definition}

\noindent
We explicitly state that the big affine h site is a site.

\begin{lemma}
\label{lemma-verify-site-h}
Let $S$ be a scheme. Let $\Sch_h$ be a big h
site containing $S$. Then $(\textit{Aff}/S)_h$ is a site.
\end{lemma}

\begin{proof}
Reasoning as in the proof of
Topologies, Lemma \ref{topologies-lemma-verify-site-etale}
it suffices to show that the collection of standard h coverings
satisfies properties (1), (2) and (3) of
Sites, Definition \ref{sites-definition-site}.
This is clear since for example, given a standard h covering
$\{T_i \to T\}_{i\in I}$ and for each
$i$ a standard h covering $\{T_{ij} \to T_i\}_{j \in J_i}$, then
$\{T_{ij} \to T\}_{i \in I, j\in J_i}$ is a h covering
(Lemma \ref{lemma-h}), $\bigcup_{i\in I} J_i$ is finite and
each $T_{ij}$ is affine. Thus $\{T_{ij} \to T\}_{i \in I, j\in J_i}$
is a standard h covering.
\end{proof}

\begin{lemma}
\label{lemma-fibre-products-h}
Let $S$ be a scheme. Let $\Sch_h$ be a big h
site containing $S$. The underlying categories of the sites
$\Sch_h$, $(\Sch/S)_h$, and $(\textit{Aff}/S)_h$ have fibre products.
In each case the obvious functor into the category $\Sch$ of
all schemes commutes with taking fibre products. The category
$(\Sch/S)_h$ has a final object, namely $S/S$.
\end{lemma}

\begin{proof}
For $\Sch_h$ it is true by construction, see
Sets, Lemma \ref{sets-lemma-what-is-in-it}.
Suppose we have $U \to S$, $V \to U$, $W \to U$ morphisms
of schemes with $U, V, W \in \Ob(\Sch_h)$.
The fibre product $V \times_U W$ in $\Sch_h$
is a fibre product in $\Sch$ and
is the fibre product of $V/S$ with $W/S$ over $U/S$ in
the category of all schemes over $S$, and hence also a
fibre product in $(\Sch/S)_h$.
This proves the result for $(\Sch/S)_h$.
If $U, V, W$ are affine, so is $V \times_U W$ and hence the
result for $(\textit{Aff}/S)_h$.
\end{proof}

\noindent
Next, we check that the big affine site defines the same
topos as the big site.

\begin{lemma}
\label{lemma-affine-big-site-h}
Let $S$ be a scheme. Let $\Sch_h$ be a big h
site containing $S$.
The functor $(\textit{Aff}/S)_h \to (\Sch/S)_h$
is cocontinuous and induces an equivalence of topoi from
$\Sh((\textit{Aff}/S)_h)$ to
$\Sh((\Sch/S)_h)$.
\end{lemma}

\begin{proof}
The notion of a special cocontinuous functor is introduced in
Sites, Definition \ref{sites-definition-special-cocontinuous-functor}.
Thus we have to verify assumptions (1) -- (5) of
Sites, Lemma \ref{sites-lemma-equivalence}.
Denote the inclusion functor
$u : (\textit{Aff}/S)_h \to (\Sch/S)_h$.
Being cocontinuous follows because any h covering of
$T/S$, $T$ affine, can be refined by a standard h covering
for example by Lemma \ref{lemma-approximate-h-cover}. Hence (1) holds.
We see $u$ is continuous simply because a standard h covering
is a h covering.
Hence (2) holds. Parts (3) and (4) follow immediately from the fact
that $u$ is fully faithful. And finally condition (5) follows from the
fact that every scheme has an affine open covering (which is
a h covering).
\end{proof}

\begin{lemma}
\label{lemma-characterize-sheaf-h}
Let $\mathcal{F}$ be a presheaf on $(\Sch/S)_h$.
Then $\mathcal{F}$ is a sheaf if and only if
\begin{enumerate}
\item $\mathcal{F}$ satisfies the sheaf condition for
Zariski coverings, and
\item if $f : V \to U$ is proper, surjective, and of finite presentation, then
$\mathcal{F}(U)$ maps bijectively to the equalizer
of the two maps $\mathcal{F}(V) \to \mathcal{F}(V \times_U V)$.
\end{enumerate}
Moreover, in the presence of (1) property (2) is equivalent to
property
\begin{enumerate}
\item[(2')] the sheaf property for $\{V \to U\}$ as in (2) with $U$ affine.
\end{enumerate}
\end{lemma}

\begin{proof}
We will show that if (1) and (2) hold, then $\mathcal{F}$ is sheaf.
Let $\{T_i \to T\}$ be a covering in $(\Sch/S)_h$.
We will verify the sheaf condition for this covering.
Let $s_i \in \mathcal{F}(T_i)$ be sections which restrict to the same
section over $T_i \times_T T_{i'}$. We will show that there exists a
unique section $s \in \mathcal{F}(T)$ restricting to $s_i$ over $T_i$.
Let $T = \bigcup U_j$ be an affine open covering.
By property (1) it suffices to produce sections $s_j \in \mathcal{F}(U_j)$
which agree on $U_j \cap U_{j'}$ in order to produce $s$.
Consider the coverings $\{T_i \times_T U_j \to U_j\}$.
Then $s_{ji} = s_i|_{T_i \times_T U_j}$ are sections agreeing
over $(T_i \times_T U_j) \times_{U_j} (T_{i'} \times_T U_j)$.
Choose a proper surjective morphism $V_j \to U_j$ of finite presentation
and a finite affine open covering $V_j = \bigcup V_{jk}$
such that $\{V_{jk} \to U_j\}$ refines $\{T_i \times_T U_j \to U_j\}$.
See Lemma \ref{lemma-approximate-h-cover}.
If $s_{jk} \in \mathcal{F}(V_{jk})$
denotes the pullback of $s_{ji}$ to $V_{jk}$ by the
implied morphisms, then we find that $s_{jk}$ glue to a section
$s'_j \in \mathcal{F}(V_j)$. Using the agreement on overlaps
once more, we find that $s'_j$ is in the equalizer of the two
maps $\mathcal{F}(V_j) \to \mathcal{F}(V_j \times_{U_j} V_j)$.
Hence by (2) we find that $s'_j$ comes from a unique section
$s_j \in \mathcal{F}(U_j)$. We omit the verification that these
sections $s_j$ have all the desired properties.

\medskip\noindent
Proof of the equivalence of (2) and (2') in the presence of (1).
Suppose $V \to U$ is a morphism of $(\Sch/S)_h$ which is
proper, surjective, and of finite presentation. Choose an
affine open covering $U = \bigcup U_i$ and set $V_i = V \times_U U_i$.
Then we see that $\mathcal{F}(U) \to \mathcal{F}(V)$
is injective because we know $\mathcal{F}(U_i) \to \mathcal{F}(V_i)$
is injective by (2') and we know $\mathcal{F}(U) \to \prod \mathcal{F}(U_i)$
is injective by (1). Finally, suppose that we are given an
$t \in \mathcal{F}(V)$ in the equalizer of the two maps
$\mathcal{F}(V) \to \mathcal{F}(V \times_U V)$.
Then $t|_{V_i}$ is in the equalizer of the two maps
$\mathcal{F}(V_i) \to \mathcal{F}(V_i \times_{U_i} V_i)$
for all $i$. Hence we obtain a unique section $s_i \in \mathcal{F}(U_i)$
mapping to $t|_{V_i}$ for all $i$ by (2').
We omit the verification that $s_i|_{U_i \cap U_j} = s_j|_{U_i \cap U_j}$
for all $i, j$; this uses the uniqueness property just shown.
By the sheaf property for the covering $U = \bigcup U_i$ we obtain
a section $s \in \mathcal{F}(U)$. We omit the proof that $s$
maps to $t$ in $\mathcal{F}(V)$.
\end{proof}

\noindent
Next, we establish some relationships between the topoi
associated to these sites.

\begin{lemma}
\label{lemma-morphism-big-h}
Let $\Sch_h$ be a big h site.
Let $f : T \to S$ be a morphism in $\Sch_h$.
The functor
$$
u : (\Sch/T)_h \longrightarrow (\Sch/S)_h,
\quad
V/T \longmapsto V/S
$$
is cocontinuous, and has a continuous right adjoint
$$
v : (\Sch/S)_h \longrightarrow (\Sch/T)_h,
\quad
(U \to S) \longmapsto (U \times_S T \to T).
$$
They induce the same morphism of topoi
$$
f_{big} :
\Sh((\Sch/T)_h)
\longrightarrow
\Sh((\Sch/S)_h)
$$
We have $f_{big}^{-1}(\mathcal{G})(U/T) = \mathcal{G}(U/S)$.
We have $f_{big, *}(\mathcal{F})(U/S) = \mathcal{F}(U \times_S T/T)$.
Also, $f_{big}^{-1}$ has a left adjoint $f_{big!}$ which commutes with
fibre products and equalizers.
\end{lemma}

\begin{proof}
The functor $u$ is cocontinuous, continuous, and commutes with fibre products
and equalizers. Hence
Sites, Lemmas \ref{sites-lemma-when-shriek} and
\ref{sites-lemma-preserve-equalizers}
apply and we deduce the formula
for $f_{big}^{-1}$ and the existence of $f_{big!}$. Moreover,
the functor $v$ is a right adjoint because given $U/T$ and $V/S$
we have $\Mor_S(u(U), V) = \Mor_T(U, V \times_S T)$
as desired. Thus we may apply
Sites, Lemmas \ref{sites-lemma-have-functor-other-way} and
\ref{sites-lemma-have-functor-other-way-morphism} to get the
formula for $f_{big, *}$.
\end{proof}

\begin{lemma}
\label{lemma-composition-h}
Given schemes $X$, $Y$, $Y$ in $(\Sch/S)_h$
and morphisms $f : X \to Y$, $g : Y \to Z$ we have
$g_{big} \circ f_{big} = (g \circ f)_{big}$.
\end{lemma}

\begin{proof}
This follows from the simple description of pushforward
and pullback for the functors on the big sites from
Lemma \ref{lemma-morphism-big-h}.
\end{proof}










\section{More on the h topology}
\label{section-h-more}

\noindent
In this section we prove a few more results on the h topology.
First, some non-examples.

\begin{example}
\label{example-structure-sheaf-not-h-sheaf}
The ``structure sheaf'' $\mathcal{O}$ is not a sheaf in the h topology.
For example, consider a surjective closed immersion of finite
presentation $X \to Y$. Then $\{X \to Y\}$ is an h covering
for example by Lemma \ref{lemma-surjective-proper-finite-presentation-h}.
Moreover, note that $X \times_Y X = X$.
Thus if $\mathcal{O}$ where a sheaf in the h topology, then
$\mathcal{O}_Y(Y) \to \mathcal{O}_X(X)$ would be bijective.
This is not the case as soon as $X$, $Y$ are affine and the morphism
$X \to Y$ is not an isomorphism.
\end{example}

\begin{example}
\label{example-representable-sheaf-not-h-sheaf}
On any of the sites $(\Sch/S)_h$ the topology is not subcanonical,
in other words, representable sheaves are not sheaves.
Namely, the ``structure sheaf'' $\mathcal{O}$ is representable
because $\mathcal{O}(X) = \Mor_S(X, \mathbf{A}^1_S)$
in $(\Sch/S)_h$ and we saw in
Example \ref{example-structure-sheaf-not-h-sheaf}
that $\mathcal{O}$ is not a sheaf.
\end{example}

\begin{lemma}
\label{lemma-limit-h-topology}
Let $T$ be an affine scheme which is written as a limit
$T = \lim_{i \in I} T_i$ of a directed inverse system of affine schemes.
\begin{enumerate}
\item Let $\mathcal{V} = \{V_j \to T\}_{j = 1, \ldots, m}$ be a
standard h covering of $T$, see Definition
\ref{definition-standard-h}.
Then there exists an index $i$ and a standard h covering
$\mathcal{V}_i = \{V_{i, j} \to T_i\}_{j = 1, \ldots, m}$
whose base change $T \times_{T_i} \mathcal{V}_i$ to $T$
is isomorphic to $\mathcal{V}$.
\item Let $\mathcal{V}_i$, $\mathcal{V}'_i$ be a pair of standard
h coverings of $T_i$. If
$f : T \times_{T_i} \mathcal{V}_i \to T \times_{T_i} \mathcal{V}'_i$ is
a morphism of coverings of $T$, then there exists an index
$i' \geq i$ and a morphism
$f_{i'} : T_{i'} \times_{T_i} \mathcal{V} \to
T_{i'} \times_{T_i} \mathcal{V}'_i$
whose base change to $T$ is $f$.
\item If
$f, g : \mathcal{V} \to \mathcal{V}'_i$
are morphisms of standard h coverings of $T_i$ whose
base changes $f_T, g_T$ to $T$ are equal then there exists an
index $i' \geq i$ such that $f_{T_{i'}} = g_{T_{i'}}$.
\end{enumerate}
In other words, the category of standard h coverings of $T$ is
the colimit over $I$ of the categories of standard h coverings of $T_i$.
\end{lemma}

\begin{proof}
By Limits, Lemma \ref{limits-lemma-descend-finite-presentation}
the category of schemes of finite presentation over $T$ is the
colimit over $I$ of the categories of finite presentation over $T_i$. By
Limits, Lemma \ref{limits-lemma-descend-affine-finite-presentation}
the same is true for category of schemes which are affine and
of finite presentation over $T$.
To finish the proof of the lemma it suffices to show that if
$\{V_{j, i} \to T_i\}_{j = 1, \ldots, m}$ is a finite family of
finitely presented morphisms with $V_{j, i}$ affine, and the
base change family $\{T \times_{T_i} V_{j, i} \to T\}$ is
an h covering, then for some $i' \geq i$ the family
$\{T_{i'} \times_{T_i} V_{j, i} \to T_{i'}\}$ is an h covering.
To see this we use Lemma \ref{lemma-approximate-h-cover} to
choose a finitely presented, proper, surjective
morphism $Y \to T$ and a finite affine open covering
$Y = \bigcup_{k = 1, \ldots, n} Y_k$ such that
$\{Y_k \to T\}_{k = 1, \ldots, n}$ refines
$\{T \times_{T_i} V_{j, i} \to T\}$.
Using the arguments above and
Limits, Lemmas \ref{limits-lemma-eventually-proper},
\ref{limits-lemma-descend-surjective}, and
\ref{limits-lemma-descend-opens}
we can find an $i' \geq i$ and a finitely presented, surjective, proper
morphism $Y_{i'} \to T_{i'}$ and an affine open covering
$Y_{i'} = \bigcup_{k = 1, \ldots, n} Y_{i', k}$
such that moreover $\{Y_{i', k} \to Y_{i'}\}$ refines
$\{T_{i'} \times_{T_i} V_{j, i} \to T_{i'}\}$.
It follows that this last mentioned family is
a h covering and the proof is complete.
\end{proof}

\begin{lemma}
\label{lemma-extend-sheaf-h}
Let $S$ be a scheme contained in a big site $\Sch_h$.
Let $F : (\Sch/S)_h^{opp} \to \textit{Sets}$ be an h sheaf satisfying
property (b) of Topologies, Lemma \ref{topologies-lemma-extend}
with $\mathcal{C} = (\Sch/S)_h$.
Then the extension $F'$ of $F$ to the category of all
schemes over $S$ satisfies the sheaf condition for all h coverings
and is limit preserving (Limits, Remark \ref{limits-remark-limit-preserving}).
\end{lemma}

\begin{proof}
This is proven by the arguments given in the proofs of
Topologies, Lemmas \ref{topologies-lemma-extend-sheaf-general} and
\ref{topologies-lemma-extend-sheaf} using
Lemmas \ref{lemma-limit-h-topology} and \ref{lemma-h-induced}.
Details omitted.
\end{proof}








\section{Blow up squares and the ph topology}
\label{section-blow-up-ph}

\noindent
Let $X$ be a scheme. Let $Z \subset X$ be a closed subscheme
such that the inclusion morphism is of finite presentation, i.e.,
the quasi-coherent sheaf of ideals corresponding to $Z$ is of
finite type. Let $b : X' \to X$ be the blowup of $X$ in $Z$
and let $E = b^{-1}(Z)$ be the exceptional divisor. See
Divisors, Section \ref{divisors-section-blowing-up}.
In this situation and in this section, let us say
\begin{equation}
\label{equation-blow-up-square}
\vcenter{
\xymatrix{
E \ar[d] \ar[r] & X' \ar[d]^b \\
Z \ar[r] & X
}
}
\end{equation}
is a {\it blow up square}.

\begin{lemma}
\label{lemma-blow-up-square-ph}
Let $\mathcal{F}$ be a sheaf on a site $(\Sch/S)_{ph}$, see
Topologies, Definition \ref{topologies-definition-big-small-ph}.
Then for any blow up square (\ref{equation-blow-up-square})
in the category $(\Sch/S)_{ph}$ the diagram
$$
\xymatrix{
\mathcal{F}(E) & \mathcal{F}(X') \ar[l] \\
\mathcal{F}(Z) \ar[u] & \mathcal{F}(X) \ar[u] \ar[l]
}
$$
is cartesian in the category of sets.
\end{lemma}

\begin{proof}
Since $Z \amalg X' \to X$ is a surjective proper morphism
we see that $\{Z \amalg X' \to X\}$ is a ph covering
(Topologies, Lemma \ref{topologies-lemma-surjective-proper-ph}).
We have
$$
(Z \amalg X') \times_X (Z \amalg X') =
Z \amalg E \amalg E \amalg X' \times_X X'
$$
Since $\mathcal{F}$ is a Zariski sheaf we see that
$\mathcal{F}$ sends disjoint unions to products.
Thus the sheaf condition for the covering
$\{Z \amalg X' \to X\}$ says that
$\mathcal{F}(X) \to \mathcal{F}(Z) \times \mathcal{F}(X')$
is injective with image the set of pairs $(t, s')$ such that
(a) $t|_E = s'|_E$ and (b) $s'$ is in the equalizer of the two maps
$\mathcal{F}(X') \to \mathcal{F}(X' \times_X X')$.
Next, observe that the obvious morphism
$$
E \times_Z E \amalg X' \longrightarrow X' \times_X X'
$$
is a surjective proper morphism as $b$ induces
an isomorphism $X' \setminus E \to X \setminus Z$. We conclude that
$\mathcal{F}(X' \times_X X') \to
\mathcal{F}(E \times_Z E) \times \mathcal{F}(X')$ is injective.
It follows that (a) $\Rightarrow$ (b) which means that the lemma is true.
\end{proof}

\begin{lemma}
\label{lemma-thickening-ph}
Let $\mathcal{F}$ be a sheaf on a site $(\Sch/S)_{ph}$
as in Topologies, Definition \ref{topologies-definition-big-small-ph}.
Let $X \to X'$ be a morphism of $(\Sch/S)_{ph}$ which is
a thickening. Then
$\mathcal{F}(X') \to \mathcal{F}(X)$ is bijective.
\end{lemma}

\begin{proof}
Observe that $X \to X'$ is a proper surjective morphism of and
$X \times_{X'} X = X$.
By the sheaf property for the ph covering $\{X \to X'\}$
(Topologies, Lemma
\ref{topologies-lemma-surjective-proper-ph})
we conclude.
\end{proof}








\section{Almost blow up squares and the h topology}
\label{section-blow-up-h}

\noindent
Consider a blow up square (\ref{equation-blow-up-square}).
Although the morphism $b : X' \to X$
is projective (Divisors, Lemma \ref{divisors-lemma-blowing-up-projective})
in general there is no simple way to guarantee that
$b$ is of finite presentation. Since h coverings are constructed
using morphisms of finite presentation, we need a variant.
Namely, we will say a commutative diagram
\begin{equation}
\label{equation-almost-blow-up-square}
\vcenter{
\xymatrix{
E \ar[d] \ar[r] & X' \ar[d]^b \\
Z \ar[r] & X
}
}
\end{equation}
of schemes is an {\it almost blow up square} if the following conditions
are satisfied
\begin{enumerate}
\item $Z \to X$ is a closed immersion of finite presentation,
\item $E = b^{-1}(Z)$ is a locally principal closed subscheme of $X'$,
\item $b$ is proper and of finite presentation,
\item the closed subscheme $X'' \subset X'$ cut out by the quasi-coherent
ideal of sections of $\mathcal{O}_{X'}$ supported on $E$
(Properties, Lemma \ref{properties-lemma-sections-supported-on-closed-subset})
is the blow up of $X$ in $Z$.
\end{enumerate}
It follows that the morphism $b$ induces an isomorphism
$X' \setminus E \to X \setminus Z$.
For some very simple examples of almost blow up squares, see
Examples \ref{example-one-generator} and
\ref{example-two-generators}.

\medskip\noindent
The base change of a blow up usually isn't a blow up,
but almost blow ups are compatible with base change.

\begin{lemma}
\label{lemma-base-change-almost-blow-up}
Consider an almost blow up square (\ref{equation-almost-blow-up-square}).
Let $Y \to X$ be any morphism. Then the base change
$$
\xymatrix{
Y \times_X E \ar[d] \ar[r] & Y \times_X X' \ar[d] \\
Y \times_X Z \ar[r] & Y
}
$$
is an almost blow up square too.
\end{lemma}

\begin{proof}
The morphism $Y \times_X X' \to Y$ is proper and of finite presentation
by Morphisms, Lemmas \ref{morphisms-lemma-base-change-proper} and
\ref{morphisms-lemma-base-change-finite-presentation}.
The morphism $Y \times_X Z \to Y$ is a closed immersion
(Morphisms, Lemma \ref{morphisms-lemma-base-change-closed-immersion}) of
finite presentation. The inverse image of $Y \times_X Z$ in $Y \times_X X'$
is equal to the inverse image of $E$ in $Y \times_X X'$ and hence is
locally principal
(Divisors, Lemma \ref{divisors-lemma-pullback-locally-principal}).
Let $X'' \subset X'$, resp.\ $Y'' \subset Y \times_X X'$ be the closed
subscheme corresponding to the quasi-coherent ideal of sections of
$\mathcal{O}_{X'}$, resp.\ $\mathcal{O}_{Y \times_Y X'}$
supported on $E$, resp.\ $Y \times_X E$.
Clearly, $Y'' \subset Y \times_X X''$ is the closed subscheme
corresponding to the quasi-coherent ideal of sections of
$\mathcal{O}_{Y \times_Y X''}$ supported on $Y \times_X (E \cap X'')$.
Thus $Y''$ is the strict transform of $Y$ relative to the blowing up
$X'' \to X$, see
Divisors, Definition \ref{divisors-definition-strict-transform}.
Thus by Divisors, Lemma \ref{divisors-lemma-strict-transform}
we see that $Y''$ is the blow up of $Y \times_X Z$ on $Y$.
\end{proof}

\noindent
One can shrink almost blow up squares.

\begin{lemma}
\label{lemma-shrink-almost-blow-up}
Consider an almost blow up square (\ref{equation-almost-blow-up-square}).
Let $W \to X'$ be a closed immersion of finite presentation.
The following are equivalent
\begin{enumerate}
\item $X' \setminus E$ is scheme theoretically contained in $W$,
\item the blowup $X''$ of $X$ in $Z$ is scheme theoretically contained in $W$,
\item the diagram
$$
\xymatrix{
E \cap W \ar[d] \ar[r] & W \ar[d] \\
Z \ar[r] & X
}
$$
is an almost blow up square. Here $E \cap W$ is the
scheme theoretic intersection.
\end{enumerate}
\end{lemma}

\begin{proof}
Assume (1). Then the surjection $\mathcal{O}_{X'} \to \mathcal{O}_W$
is an isomorphism over the open $X' \subset E$. Since the ideal sheaf
of $X'' \subset X'$ is the sections of $\mathcal{O}_{X'}$ supported on $E$
(by our definition of almost blow up squares)
we conclude (2) is true. If (2) is true, then (3) holds.
If (3) holds, then (1) holds because $X'' \cap (X' \setminus E)$
is isomorphic to $X \setminus Z$ which in turn is isomorphic
to $X' \setminus E$.
\end{proof}

\noindent
The actual blowup is the limit of shrinkings of any given almost blowup.

\begin{lemma}
\label{lemma-blow-up-limit-almost-blow-up}
Consider an almost blow up square (\ref{equation-almost-blow-up-square})
with $X$ quasi-compact and quasi-separated. Then the blowup $X''$ of $X$
in $Z$ can be written as
$$
X'' = \lim X'_i
$$
where the limit is over the directed system of closed subschemes
$X'_i \subset X'$ of finite presentation satisfying the equivalent
conditions of Lemma \ref{lemma-shrink-almost-blow-up}.
\end{lemma}

\begin{proof}
Let $\mathcal{I} \subset \mathcal{O}_{X'}$ be the quasi-coherent
sheaf of ideals corresponding to $X''$. By
Properties, Lemma \ref{properties-lemma-quasi-coherent-colimit-finite-type}
we can write $\mathcal{I}$ as the filtered colimit
$\mathcal{I} = \colim \mathcal{I}_i$ of its quasi-coherent
submodules of finite type. Since these modules correspond
$1$-to-$1$ to the closed subschemes $X'_i$ the proof is complete.
\end{proof}

\noindent
Almost blow up squares exist.

\begin{lemma}
\label{lemma-almost-blow-up-square}
Let $X$ be a quasi-compact and quasi-separated scheme. Let $Z \subset X$
be a closed subscheme cut out by a finite type quasi-coherent
sheaf of ideals. Then there exists an almost blow up square as in
(\ref{equation-almost-blow-up-square}).
\end{lemma}

\begin{proof}
We may write $X = \lim X_i$ as a directed limit of an inverse system
of Noetherian schemes with affine transition morphisms, see
Limits, Proposition \ref{limits-proposition-approximate}.
We can find an index $i$ and a closed immersion $Z_i \to X_i$
whose base change to $X$ is the closed immersion $Z \to X$.
See Limits, Lemmas \ref{limits-lemma-descend-finite-presentation} and
\ref{limits-lemma-descend-closed-immersion-finite-presentation}.
Let $b_i : X'_i \to X_i$ be the blowing up with center $Z_i$.
This produces a blow up square
$$
\xymatrix{
E_i \ar[r] \ar[d] & X'_i \ar[d]^{b_i} \\
Z_i \ar[r] & X_i
}
$$
where all the morphisms are finite type morphisms of Noetherian schemes
and hence of finite presentation. Thus this is an almost blow up square.
By Lemma \ref{lemma-base-change-almost-blow-up}
the base change of this diagram to $X$ produces the desired
almost blow up square.
\end{proof}

\noindent
Almost blow up squares are unique up to shrinking as in
Lemma \ref{lemma-shrink-almost-blow-up}.

\begin{lemma}
\label{lemma-almost-blow-up-unique}
Let $X$ be a quasi-compact and quasi-separated scheme and let $Z \subset X$
be a closed subscheme cut out by a finite type quasi-coherent sheaf of ideals.
Suppose given almost blow up squares (\ref{equation-almost-blow-up-square})
$$
\xymatrix{
E_k \ar[r] \ar[d] & X_k' \ar[d] \\
Z \ar[r] & X
}
$$
for $k = 1, 2$, then there exists an almost blow up square
$$
\xymatrix{
E \ar[r] \ar[d] & X' \ar[d] \\
Z \ar[r] & X
}
$$
and closed immersions $i_k : X' \to X'_k$ over $X$
with $E = i_k^{-1}(E_k)$.
\end{lemma}

\begin{proof}
Denote $X'' \to X$ the blowing up of $Z$ in $X$.
We view $X''$ as a closed subscheme of both $X'_1$ and $X'_2$.
Write $X'' = \lim X'_{1, i}$ as in
Lemma \ref{lemma-blow-up-limit-almost-blow-up}.
By Limits, Proposition
\ref{limits-proposition-characterize-locally-finite-presentation}
there exists an $i$ and a morphism $h : X'_{1, i} \to X'_2$ agreeing
with the inclusions $X'' \subset X'_{1, i}$ and $X'' \subset X'_2$.
By Limits, Lemma \ref{limits-lemma-eventually-closed-immersion}
the restriction of $h$ to $X'_{1, i'}$ is a closed immersion
for some $i' \geq i$. This finishes the proof.
\end{proof}

\noindent
Our flattening techniques for blowing up are inherited by
almost blowups in favorable situations.

\begin{lemma}
\label{lemma-flat-after-almost-blowing-up}
Let $Y$ be a quasi-compact and quasi-separated scheme.
Let $X$ be a scheme of finite presentation over $Y$.
Let $V \subset Y$ be a quasi-compact open such that
$X_V \to V$ is flat. Then there exist a commutative diagram
$$
\xymatrix{
E \ar[ddd] \ar[rd] & & & D \ar[lll] \ar[ddd] \ar[ld] \\
& Y' \ar[d] & X' \ar[l] \ar[d] \\
& Y & X \ar[l] \\
Z \ar[ru] & & & T \ar[lll] \ar[lu]
}
$$
whose right and left hand squares are almost blow up squares,
whose lower and top squares are cartesian, such that
$Z \cap V = \emptyset$, and
such that $X' \to Y'$ is flat (and of finite presentation).
\end{lemma}

\begin{proof}
If $Y$ is a Noetherian scheme, then this lemma follows immediately
from Lemma \ref{lemma-flat-after-blowing-up}
because in this case blow up squares are almost blow up squares
(we also use that strict transforms are blow ups).
The general case is reduced to the Noetherian case by
absolute Noetherian approximation.

\medskip\noindent
We may write $Y = \lim Y_i$ as a directed limit of an inverse system
of Noetherian schemes with affine transition morphisms, see
Limits, Proposition \ref{limits-proposition-approximate}.
We can find an index $i$ and a morphism $X_i \to Y_i$
of finite presentation whose base change to $Y$ is $X \to Y$.
See Limits, Lemmas \ref{limits-lemma-descend-finite-presentation}.
After increasing $i$ we may assume $V$ is the inverse image of
an open subscheme $V_i \subset Y_i$, see
Limits, Lemma \ref{limits-lemma-descend-opens}.
Finally, after increasing $i$ we may assume that $X_{i, V_i} \to V_i$
is flat, see
Limits, Lemma \ref{limits-lemma-descend-flat-finite-presentation}.
By the Noetherian case, we may construct a diagram as in the
lemma for $X_i \to Y_i \supset V_i$. The base change of this
diagram by $Y \to Y_i$ provides the solution. Use that base change
preserves properties of morphisms, see Morphisms, Lemmas
\ref{morphisms-lemma-base-change-proper},
\ref{morphisms-lemma-base-change-finite-presentation},
\ref{morphisms-lemma-base-change-closed-immersion}, and
\ref{morphisms-lemma-base-change-flat}
and that base change of an almost
blow up square is an almost blow up square, see
Lemma \ref{lemma-base-change-almost-blow-up}.
\end{proof}

\begin{lemma}
\label{lemma-blow-up-square-h}
Let $\mathcal{F}$ be a sheaf on one of the sites $(\Sch/S)_h$
constructed in Definition \ref{definition-big-small-h}.
Then for any almost blow up square (\ref{equation-almost-blow-up-square})
in the category $(\Sch/S)_h$ the diagram
$$
\xymatrix{
\mathcal{F}(E) & \mathcal{F}(X') \ar[l] \\
\mathcal{F}(Z) \ar[u] & \mathcal{F}(X) \ar[u] \ar[l]
}
$$
is cartesian in the category of sets.
\end{lemma}

\begin{proof}
Since $Z \amalg X' \to X$ is a surjective proper morphism
of finite presentation we see that $\{Z \amalg X' \to X\}$ is an h
covering (Lemma \ref{lemma-surjective-proper-finite-presentation-h}).
We have
$$
(Z \amalg X') \times_X (Z \amalg X') =
Z \amalg E \amalg E \amalg X' \times_X X'
$$
Since $\mathcal{F}$ is a Zariski sheaf we see that
$\mathcal{F}$ sends disjoint unions to products.
Thus the sheaf condition for the covering
$\{Z \amalg X' \to X\}$ says that
$\mathcal{F}(X) \to \mathcal{F}(Z) \times \mathcal{F}(X')$
is injective with image the set of pairs $(t, s')$ such that
(a) $t|_E = s'|_E$ and (b) $s'$ is in the equalizer of the two maps
$\mathcal{F}(X') \to \mathcal{F}(X' \times_X X')$.
Next, observe that the obvious morphism
$$
E \times_Z E \amalg X' \longrightarrow X' \times_X X'
$$
is a surjective proper morphism of finite presentation as $b$ induces
an isomorphism $X' \setminus E \to X \setminus Z$. We conclude that
$\mathcal{F}(X' \times_X X') \to
\mathcal{F}(E \times_Z E) \times \mathcal{F}(X')$ is injective.
It follows that (a) $\Rightarrow$ (b) which means that the lemma is true.
\end{proof}

\begin{lemma}
\label{lemma-thickening-h}
Let $\mathcal{F}$ be a sheaf on one of the sites $(\Sch/S)_h$
constructed in Definition \ref{definition-big-small-h}.
Let $X \to X'$ be a morphism of $(\Sch/S)_h$ which is
a thickening and of finite presentation. Then
$\mathcal{F}(X') \to \mathcal{F}(X)$ is bijective.
\end{lemma}

\begin{proof}
First proof. Observe that $X \to X'$ is a proper surjective morphism of
finite presentation and $X \times_{X'} X = X$.
By the sheaf property for the h covering $\{X \to X'\}$
(Lemma \ref{lemma-surjective-proper-finite-presentation-h})
we conclude.

\medskip\noindent
Second proof (silly). The blow up of $X'$ in $X$ is the empty scheme.
The reason is that the affine blowup algebra $A[\frac{I}{a}]$
(Algebra, Section \ref{algebra-section-blow-up})
is zero if $a$ is a nilpotent element of $A$. Details omitted.
Hence we get an almost blow up square of the form
$$
\xymatrix{
\emptyset \ar[r] \ar[d] & \emptyset \ar[d] \\
X \ar[r] & X'
}
$$
Since $\mathcal{F}$ is a sheaf we have that $\mathcal{F}(\emptyset)$
is a singleton.
Applying Lemma \ref{lemma-blow-up-square-h} we get the conclusion.
\end{proof}

\begin{proposition}
\label{proposition-check-h}
Let $\mathcal{F}$ be a presheaf on one of the sites $(\Sch/S)_h$
constructed in Definition \ref{definition-big-small-h}.
Then $\mathcal{F}$ is a sheaf if and only if the following
conditions are satisfied
\begin{enumerate}
\item $\mathcal{F}$ is a sheaf for the Zariski topology,
\item given a morphism $f : X \to Y$ of $(\Sch/S)_h$ with $Y$ affine
and $f$ surjective, flat, proper, and of finite presentation, then
$\mathcal{F}(Y)$ is the equalizer of the two maps
$\mathcal{F}(X) \to \mathcal{F}(X \times_Y X)$,
\item given an almost blow up square (\ref{equation-almost-blow-up-square})
with $X$ affine in the category $(\Sch/S)_h$ the diagram
$$
\xymatrix{
\mathcal{F}(E) & \mathcal{F}(X') \ar[l] \\
\mathcal{F}(Z) \ar[u] & \mathcal{F}(X) \ar[u] \ar[l]
}
$$
is cartesian in the category of sets.
\end{enumerate}
\end{proposition}

\begin{proof}
Assume $\mathcal{F}$ is a sheaf. Condition (1) holds because
a Zariski covering is a h covering, see
Lemma \ref{lemma-zariski-h}.
Condition (2) holds because for $f$ as in (2) we have that
$\{X \to Y\}$ is an fppf covering (this is clear)
and hence an h covering, see Lemma \ref{lemma-zariski-h}.
Condition (3) holds by Lemma \ref{lemma-blow-up-square-h}.

\medskip\noindent
Conversely, assume $\mathcal{F}$ satisfies (1), (2), and (3).
We will prove $\mathcal{F}$ is a sheaf by applying
Lemma \ref{lemma-characterize-sheaf-h}. Consider
a surjective, finitely presented, proper morphism
$f : X \to Y$ in $(\Sch/S)_h$ with $Y$ affine. It suffices to show
that $\mathcal{F}(Y)$ is the equalizer of the two maps
$\mathcal{F}(X) \to \mathcal{F}(X \times_Y X)$.

\medskip\noindent
First, assume that $f : X \to Y$ is in addition a closed immersion
(in other words, $f$ is a thickening). Then the blow up of $Y$ in $X$
is the empty scheme and this produces an almost blow up square
consisting with $\emptyset, \emptyset, X, Y$ at the vertices
(compare with the second proof of Lemma \ref{lemma-thickening-h}).
Hence we see that condition (3) tells us that
$$
\xymatrix{
\mathcal{F}(\emptyset) & \mathcal{F}(\emptyset) \ar[l] \\
\mathcal{F}(X) \ar[u] & \mathcal{F}(Y) \ar[u] \ar[l]
}
$$
is cartesian in the category of sets. Since $\mathcal{F}$ is a sheaf
for the Zariski topology, we see that $\mathcal{F}(\emptyset)$
is a singleton. Hence we see that $\mathcal{F}(X) = \mathcal{F}(Y)$.

\medskip\noindent
Interlude A: let $T \to T'$ be a morphism of $(\Sch/S)_h$ which is
a thickening and of finite presentation. Then
$\mathcal{F}(T') \to \mathcal{F}(T)$ is bijective.
Namely, choose an affine open covering $T' = \bigcup T'_i$
and let $T_i = T \times_{T'} T'_i$ be the corresponding affine
opens of $T$. Then we have $\mathcal{F}(T'_i) \to \mathcal{F}(T_i)$
is bijective for all $i$ by the result of the previous paragraph.
Using the Zariski sheaf property we see that
$\mathcal{F}(T') \to \mathcal{F}(T)$ is injective. Repeating the
argument we find that it is bijective. Minor details omitted.

\medskip\noindent
Interlude B: consider an almost blow up square
(\ref{equation-almost-blow-up-square}) in the category $(\Sch/S)_h$.
Then we claim the diagram
$$
\xymatrix{
\mathcal{F}(E) & \mathcal{F}(X') \ar[l] \\
\mathcal{F}(Z) \ar[u] & \mathcal{F}(X) \ar[u] \ar[l]
}
$$
is cartesian in the category of sets. This is a consequence of condition
(3) as follows by choosing an affine open covering of $X$ and arguing
as in Interlude A. We omit the details.

\medskip\noindent
Next, let $f : X \to Y$ be a surjective, finitely presented, proper morphism
in $(\Sch/S)_h$ with $Y$ affine. Choose a generic flatness stratification
$$
Y \supset Y_0 \supset Y_1 \supset \ldots \supset Y_t = \emptyset
$$
as in More on Morphisms, Lemma
\ref{more-morphisms-lemma-generic-flatness-stratification-scheme}
for $f : X \to Y$.
We are going to use all the properties of the stratification
without further mention. Set $X_0 = X \times_Y Y_0$.
By the Interlude B we have $\mathcal{F}(Y_0) = \mathcal{F}(Y)$,
$\mathcal{F}(X_0) = \mathcal{F}(X)$, and
$\mathcal{F}(X_0 \times_{Y_0} X_0) = \mathcal{F}(X \times_Y X)$.

\medskip\noindent
We are going to prove the result by induction on $t$. If $t = 1$
then $X_0 \to Y_0$ is surjective, proper, flat, and of finite presentation
and we see that the result holds by property (2).
For $t > 1$ we may replace $Y$ by $Y_0$ and $X$ by $X_0$
(see above) and assume $Y = Y_0$.

\medskip\noindent
Consider the quasi-compact open subscheme
$V = Y \setminus Y_1 = Y_0 \setminus Y_1$.
Choose a diagram
$$
\xymatrix{
E \ar[ddd] \ar[rd] & & & D \ar[lll] \ar[ddd] \ar[ld] \\
& Y' \ar[d] & X' \ar[l] \ar[d] \\
& Y & X \ar[l] \\
Z \ar[ru] & & & T \ar[lll] \ar[lu]
}
$$
as in Lemma \ref{lemma-flat-after-almost-blowing-up}
for $f : X \to Y \supset V$. Then $f' : X' \to Y'$ is flat and of
finite presentation. Also $f'$ is proper (use
Morphisms, Lemmas \ref{morphisms-lemma-composition-proper} and
\ref{morphisms-lemma-image-proper-scheme-closed} to see this).
Thus the image $W = f'(X') \subset Y'$ is an open
(Morphisms, Lemma \ref{morphisms-lemma-fppf-open}) and closed
subscheme of $Y'$. Observe that $Y' \setminus E$ is contained
in $W$. By Lemma \ref{lemma-shrink-almost-blow-up}
this means we may replace $Y'$ by $W$
in the above diagram. In other words, we may and do
assume $f'$ is surjective. At this point we know that
$$
\vcenter{
\xymatrix{
\mathcal{F}(E) & \mathcal{F}(Y') \ar[l] \\
\mathcal{F}(Z) \ar[u] & \mathcal{F}(Y) \ar[u] \ar[l]
}
}
\quad\text{and}\quad
\vcenter{
\xymatrix{
\mathcal{F}(D) & \mathcal{F}(X') \ar[l] \\
\mathcal{F}(T) \ar[u] & \mathcal{F}(X) \ar[u] \ar[l]
}
}
$$
are cartesian by Interlude B. Note that
$Z \cap Y_1 \to Z$ is a thickening of finite
presentation (as $Z$ is set theoretically contained in $Y_1$
as a closed subscheme of $Y$ disjoint from $V$).
Thus we obtain a filtration
$$
Z \supset Z \cap Y_1 \supset Z \cap Y_2 \subset \ldots \subset
Z \cap Y_t = \emptyset
$$
as above for the restriction $T = Z \times_Y X \to Z$ of $f$ to $T$.
Thus by induction hypothesis we find that
$\mathcal{F}(Z) \to \mathcal{F}(T)$
is an injective map of sets whose image is the equalizer
of the two maps $\mathcal{F}(T) \to
\mathcal{F}(T \times_Z T)$.

\medskip\noindent
Let $s \in \mathcal{F}(X)$ be in the equalizer of the two maps
$\mathcal{F}(X) \to \mathcal{F}(X \times_Y X)$.
By the above we see that the restriction $s|_T$
comes from a unique element $t \in \mathcal{F}(Z)$
and similarly that the restriction $s|_{X'}$
comes from a unique element $t' \in \mathcal{F}(Y')$.
Chasing sections using the restriction maps for $\mathcal{F}$
corresponding to the arrows in the huge commutative diagram above
the reader finds that $t$ and $t'$ restrict to the same element of
$\mathcal{F}(E)$ because they restrict to the same element of
$\mathcal{F}(D)$ and we have (2); here we use that $D \to E$ is
surjective, flat, proper, and of finite presentation as the restriction
of $X' \to Y'$. Thus by the first of the two
cartesian squares displayed above we get a unique section
$u \in \mathcal{F}(Y)$
restricting to $t$ and $t'$ on $Z$ and $Y'$.
To see that $u$ restrict to $s$ on $X$ use the second diagram.
\end{proof}

\begin{example}
\label{example-one-generator}
Let $A$ be a ring. Let $f \in A$ be an element. Let $J \subset A$
be a finitely generated ideal annihilated by a power of $f$.
Then
$$
\xymatrix{
E = \Spec(A/fA + J) \ar[r] \ar[d] & \Spec(A/J) = X' \ar[d] \\
Z = \Spec(A/fA) \ar[r] & \Spec(A) = X
}
$$
is an almost blowup square.
\end{example}

\begin{example}
\label{example-two-generators}
Let $A$ be a ring. Let $f_1, f_2 \in A$ be elements.
$$
\xymatrix{
E = \text{Proj}(A/(f_1, f_2)[T_0, T_1]) \ar[r] \ar[d] &
\text{Proj}(A[T_0, T_1]/(f_2 T_0 - f_1 T_1) = X' \ar[d] \\
Z = \Spec(A/(f_1, f_2)) \ar[r] & \Spec(A) = X
}
$$
is an almost blowup square.
\end{example}

\begin{lemma}
\label{lemma-refine-check-h}
Let $\mathcal{F}$ be a presheaf on one of the sites $(\Sch/S)_h$
constructed in Definition \ref{definition-big-small-h}.
Then $\mathcal{F}$ is a sheaf if and only if the following
conditions are satisfied
\begin{enumerate}
\item $\mathcal{F}$ is a sheaf for the Zariski topology,
\item given a morphism $f : X \to Y$ of $(\Sch/S)_h$ with $Y$ affine
and $f$ surjective, flat, proper, and of finite presentation, then
$\mathcal{F}(Y)$ is the equalizer of the two maps
$\mathcal{F}(X) \to \mathcal{F}(X \times_Y X)$,
\item $\mathcal{F}$ turns an almost blow up square as in
Example \ref{example-one-generator} in the category $(\Sch/S)_h$
into a cartesian diagram of sets, and
\item $\mathcal{F}$ turns an almost blow up square as in
Example \ref{example-two-generators} in the category $(\Sch/S)_h$
into a cartesian diagram of sets.
\end{enumerate}
\end{lemma}

\begin{proof}
By Proposition \ref{proposition-check-h} it suffices to show that given
an almost blow up square (\ref{equation-almost-blow-up-square})
with $X$ affine in the category $(\Sch/S)_h$ the diagram
$$
\xymatrix{
\mathcal{F}(E) & \mathcal{F}(X') \ar[l] \\
\mathcal{F}(Z) \ar[u] & \mathcal{F}(X) \ar[u] \ar[l]
}
$$
is cartesian in the category of sets. The rough idea of the proof
is to dominate the morphism by other almost blowup squares to which
we can apply assumptions (3) and (4) locally.

\medskip\noindent
Suppose we have an almost blow up square
(\ref{equation-almost-blow-up-square}) in the category $(\Sch/S)_h$,
an open covering $X = \bigcup U_i$, and open coverings
$U_i \cap U_j = \bigcup U_{ijk}$ such that the diagrams
$$
\vcenter{
\xymatrix{
\mathcal{F}(E \cap b^{-1}(U_i)) & \mathcal{F}(b^{-1}(U_i)) \ar[l] \\
\mathcal{F}(Z \cap U_i) \ar[u] & \mathcal{F}(U_i) \ar[u] \ar[l]
}
}
\quad\text{and}\quad
\vcenter{
\xymatrix{
\mathcal{F}(E \cap b^{-1}(U_{ijk})) &
\mathcal{F}(b^{-1}(U_{ijk})) \ar[l] \\
\mathcal{F}(Z \cap U_{ijk}) \ar[u] &
\mathcal{F}(U_{ijk}) \ar[u] \ar[l]
}
}
$$
are cartesian, then the same is true for
$$
\xymatrix{
\mathcal{F}(E) & \mathcal{F}(X') \ar[l] \\
\mathcal{F}(Z) \ar[u] & \mathcal{F}(X) \ar[u] \ar[l]
}
$$
This follows as $\mathcal{F}$ is a sheaf in the Zariski topology.

\medskip\noindent
In particular, if we have a blow up square
(\ref{equation-almost-blow-up-square}) such that $b : X' \to X$
is a closed immersion and $Z$ is a locally principal closed
subscheme, then we see that
$\mathcal{F}(X) = \mathcal{F}(X') \times_{\mathcal{F}(E)} \mathcal{F}(Z)$.
Namely, affine locally on $X$ we obtain an almost blow up square as in (3).

\medskip\noindent
Let $Z \subset X$, $E_k \subset X'_k \to X$, $E \subset X' \to X$, and
$i_k : X' \to X'_k$ be as in the statement of
Lemma \ref{lemma-almost-blow-up-unique}. Then
$$
\xymatrix{
E \ar[d] \ar[r] & X' \ar[d] \\
E_k \ar[r] & X'_k
}
$$
is an almost blow up square of the kind discussed in the previous
paragraph. Thus
$$
\mathcal{F}(X'_k) = \mathcal{F}(X') \times_{\mathcal{F}(E)} \mathcal{F}(E_k)
$$
for $k = 1, 2$ by the result of the previous paragraph. It follows that
$$
\mathcal{F}(X) \longrightarrow
\mathcal{F}(X'_k) \times_{\mathcal{F}(E_k)} \mathcal{F}(Z)
$$
is bijective for $k = 1$ if and only if it is bijective for $k = 2$.
Thus given a closed immersion $Z \to X$ of finite presentation
with $X$ quasi-compact and quasi-separated, whether or not
$\mathcal{F}(X) = \mathcal{F}(X') \times_{\mathcal{F}(E)} \mathcal{F}(Z)$
is independent of the choice of the almost blow up square
(\ref{equation-almost-blow-up-square}) one chooses.
(Moreover, by Lemma \ref{lemma-almost-blow-up-square}
there does indeed exist an almost
blow up square for $Z \subset X$.)

\medskip\noindent
Finally, consider an affine object $X$ of $(\Sch/S)_h$
and a closed immersion $Z \to X$ of finite presentation.
We will prove the desired property for the pair $(X, Z)$
by induction on the number of generators $r$ for the ideal
defining $Z$ in $X$. If the number of generators is $\leq 2$,
then we can choose our almost blow up square as
in Example \ref{example-two-generators}
and we conclude by assumption (4).

\medskip\noindent
Induction step. Suppose $X = \Spec(A)$ and $Z = \Spec(A/(f_1, \ldots, f_r))$
with $r > 2$. Choose a blow up square
(\ref{equation-almost-blow-up-square})
for the pair $(X, Z)$. Set $Z_1 = \Spec(A/(f_1, f_2))$
and let
$$
\xymatrix{
E_1 \ar[d] \ar[r] & Y \ar[d] \\
Z_1 \ar[r] & X
}
$$
be the almost blow up square constructed in
Example \ref{example-two-generators}.
By Lemma \ref{lemma-base-change-almost-blow-up} the base changes
$$
(I)
\vcenter{
\xymatrix{
Y \times_X E \ar[r] \ar[d] & Y \times_X X' \ar[d] \\
Y \times_X Z \ar[r] & Y
}
}
\quad\text{and}\quad
(II)
\vcenter{
\xymatrix{
E \ar[r] \ar[d] & Z_1 \times_X X' \ar[d] \\
Z \ar[r] & Z_1
}
}
$$
are almost blow up squares. The ideal of $Z$ in $Z_1$ is generated
by $r - 2$ elements. The ideal of $Y \times_X Z$
is generated by the pullbacks of $f_1, \ldots, f_r$ to $Y$. Locally on $Y$
the ideal generated by $f_1, f_2$ can be generated by
one element, thus $Y \times_X Z$ is affine locally on $Y$
cut out by at most $r - 1$ elements.
By induction hypotheses and the discussion above
$$
\mathcal{F}(Y) =
\mathcal{F}(Y \times_X X') \times_{\mathcal{F}(Y \times_X E)}
\mathcal{F}(Y \times_X Z)
$$
and
$$
\mathcal{F}(Z_1) =
\mathcal{F}(Z_1 \times_X X') \times_{\mathcal{F}(E)}
\mathcal{F}(Z)
$$
By assumption (4) we have
$$
\mathcal{F}(X) =
\mathcal{F}(Y) \times_{\mathcal{F}(E_1)} \mathcal{F}(Z_1)
$$
Now suppose we have a pair $(s', t)$ with $s' \in \mathcal{F}(X')$
and $t \in \mathcal{F}(Z)$ with same restriction in $\mathcal{F}(E)$.
Then $(s'|{Z_1 \times_X X'}, t)$ are the image of a unique element
$t_1 \in \mathcal{F}(Z_1)$. Similarly,
$(s'|_{Y \times_X X'}, t|_{Y \times_X Z})$ are the image of a
unique element $s_Y \in \mathcal{F}(Y)$.
We claim that $s_Y$ and $t_1$ restrict to the same element
of $\mathcal{F}(E_1)$. This is true because the almost blow up
square
$$
\xymatrix{
E_1 \times_X E \ar[r] \ar[d] & E_1 \times_X X' \ar[d] \\
E_1 \times_X Z \ar[r] & E_1
}
$$
is the base change of almost blow up square (I) via $E_1 \to Y$ and
the base change of almost blow up square (II) via $E_1 \to Z_1$ and
because the pairs of sections used to construct $s_Y$ and $t_1$ match.
Thus by the third fibre product equality we see that there is
a unique $s \in \mathcal{F}(X)$ mapping to $s_Y$ in $\mathcal{F}(Y)$
and to $t_1$ in $\mathcal{F}(Z)$.
We omit the verification that $s$ maps to $s'$ in $\mathcal{F}(X')$
and to $t$ in $\mathcal{F}(Z)$; hint: use uniqueness of $s$ just
constructed and work affine locally.
\end{proof}

\begin{lemma}
\label{lemma-refine-check-h-stack}
Let $p : \mathcal{S} \to (\Sch/S)_h$ be a category fibred in groupoids.
Then $\mathcal{S}$ is a stack in groupoids if and only if the following
conditions are satisfied
\begin{enumerate}
\item $\mathcal{S}$ is a stack in groupoids for the Zariski topology,
\item given a morphism $f : X \to Y$ of $(\Sch/S)_h$ with $Y$ affine
and $f$ surjective, flat, proper, and of finite presentation, then
$$
\mathcal{S}_Y \longrightarrow
\mathcal{S}_X \times_{\mathcal{S}_{X \times_Y X}} \mathcal{S}_X
$$
is an equivalence of categories,
\item for an almost blow up square as in
Example \ref{example-one-generator} or \ref{example-two-generators}
in the category $(\Sch/S)_h$ the functor
$$
\mathcal{S}_X \longrightarrow
\mathcal{S}_Z \times_{\mathcal{S}_E} \mathcal{S}_{X'}
$$
is an equivalence of categories.
\end{enumerate}
\end{lemma}

\begin{proof}
This lemma is a formal consequence of Lemma \ref{lemma-refine-check-h}
and our definition of stacks in groupoids.
For example, assume (1), (2), (3). To show that
$\mathcal{S}$ is a stack, we have
to prove descent for morphisms and objects, see
Stacks, Definition \ref{stacks-definition-stack-in-groupoids}.

\medskip\noindent
If $x, y$ are objects of $\mathcal{S}$ over an object $U$ of
$(\Sch/S)_h$, then our assumptions imply $\mathit{Isom}(x, y)$
is a presheaf on $(\Sch/U)_h$ which satisfies
(1), (2), (3), and (4) of Lemma \ref{lemma-refine-check-h}
and therefore is a sheaf. Some details omitted.

\medskip\noindent
Let $\{U_i \to U\}_{i \in I}$ be a covering of $(\Sch/S)_h$.
Let $(x_i, \varphi_{ij})$ be a descent datum in $\mathcal{S}$
relative to the family $\{U_i \to U\}_{i \in I}$, see
Stacks, Definition \ref{stacks-definition-descent-data}.
Consider the rule $F$ which to $V/U$ in $(\Sch/U)_h$ associates
the set of pairs $(y, \psi_i)$ where $y$ is an object of $\mathcal{S}_V$
and $\psi_i : y|_{U_i \times_U V} \to x_i|_{U_i \times_U V}$
is a morphism of $\mathcal{S}$ over $U_i \times_U V$
such that
$$
\varphi_{ij}|_{U_i \times_U U_j \times_U V}
\circ
\psi_i|_{U_i \times_U U_j \times_U V}
=
\psi_j|_{U_i \times_U U_j \times_U V}
$$
up to isomorphism. Since we already have descent for morphisms, it is
clear that $F(V/U)$ is either empty or a singleton set. On the other hand,
we have $F(U_{i_0}/U)$ is nonempty because it contains
$(x_{i_0}, \varphi_{i_0i})$. Since our goal is to prove that $F(U/U)$
is nonempty, it suffices to show that $F$ is a sheaf on $(\Sch/U)_h$.
To do this we may use the criterion of Lemma \ref{lemma-refine-check-h}.
However, our assumptions (1), (2), (3) imply (by drawing some
commutative diagrams which we omit), that properties (1), (2), (3), and (4)
of Lemma \ref{lemma-refine-check-h} hold for $F$.

\medskip\noindent
We omit the verification that if $\mathcal{S}$ is a stack in groupoids,
then (1), (2), and (3) are satisfied.
\end{proof}





\section{Absolute weak normalization and h coverings}
\label{section-h-and-weak-normalization}

\noindent
In this section we use the criteria found in
Section \ref{section-blow-up-h}
to exhibit some h sheaves and we relate h sheafification
of the structure sheaf to absolute weak normalization.
We will need the following elementary lemma to do this.

\begin{lemma}
\label{lemma-funny-blow-up}
Let $Z, X, X', E$ be an almost blow up square as in
Example \ref{example-two-generators}.
Then $H^p(X', \mathcal{O}_{X'}) = 0$ for $p > 0$ and
$\Gamma(X, \mathcal{O}_X) \to \Gamma(X', \mathcal{O}_{X'})$
is a surjective map of rings whose kernel is an ideal of square zero.
\end{lemma}

\begin{proof}
First assume that $A = \mathbf{Z}[f_1, f_2]$ is the polynomial ring.
In this case our almost blow up square is the blowing up of $X = \Spec(A)$
in the closed subscheme $Z$ and in fact $X' \subset \mathbf{P}^1_X$
is an effective Cartier divisor cut out by the global section
$f_2T_0 - f_1 T_1$ of $\mathcal{O}_{\mathbf{P}^1_X}(1)$.
Thus we have a resolution
$$
0 \to
\mathcal{O}_{\mathbf{P}^1_X}(-1) \to
\mathcal{O}_{\mathbf{P}^1_X} \to
\mathcal{O}_{X'} \to
0
$$
Using the description of the cohomology given in
Cohomology of Schemes, Section
\ref{coherent-section-cohomology-projective-space}
it follows that in this case
$\Gamma(X, \mathcal{O}_X) \to \Gamma(X', \mathcal{O}_{X'})$
is an isomorphism and $H^1(X', \mathcal{O}_{X'}) = 0$.

\medskip\noindent
Next, we observe that any diagram as in Example \ref{example-two-generators}
is the base change of the diagram in the previous paragraph by the
ring map $\mathbf{Z}[f_1, f_2] \to A$. Hence by More on Morphisms, Lemmas
\ref{more-morphisms-lemma-check-h1-fibre-zero},
\ref{more-morphisms-lemma-h1-fibre-zero}, and
\ref{more-morphisms-lemma-h1-fibre-zero-check-h0-kappa}
we conclude that $H^1(X', \mathcal{O}_{X'})$ is zero in general
and the surjectivity of the map
$H^0(X, \mathcal{O}_X) \to H^0(X', \mathcal{O}_{X'})$ in general.

\medskip\noindent
Next, in the general case, let us study the kernel. If
$a \in A$ maps to zero, then looking on affine charts
we see that
$$
a = (f_1x - f_2)(a_0 + a_1x + \ldots + a_rx^r)\text{ in }A[x]
$$
for some $r \geq 0$ and $a_0, \ldots, a_r \in A$ and similarly
$$
a = (f_1 - f_2y)(b_0 + b_1y + \ldots + b_s y^s)\text{ in }A[y]
$$
for some $s \geq 0$ and $b_0, \ldots, b_s \in A$. This means we
have
$$
a = f_2 a_0,\ f_1 a_0 = f_2 a_1,\ \ldots,\ f_1 a_r = 0,
\ a = f_1 b_0,\ f_2 b_0 = f_1 b_1,\ \ldots,\ f_2 b_s = 0
$$
If $(a', r', a'_i, s', b'_j)$ is a second such system, then we have
$$
aa' = f_1f_2a_0b'_0 = f_1f_2a_1b'_1 = f_1f_2a_2b'_2 = \ldots = 0
$$
as desired.
\end{proof}

\noindent
For an $\mathbf{F}_p$-algebra $A$
we set $\colim_F A$ equal to the colimit of the system
$$
A \xrightarrow{F} A \xrightarrow{F} A \xrightarrow{F} \ldots
$$
where $F : A \to A$, $a \mapsto a^p$ is the Frobenius endomorphism.

\begin{lemma}
\label{lemma-h-sheaf-colim-F}
Let $p$ be a prime number. Let $S$ be a scheme over $\mathbf{F}_p$.
Let $(\Sch/S)_h$ be a site as in Definition \ref{definition-big-small-h}.
There is a unique sheaf $\mathcal{F}$ on $(\Sch/S)_h$ such that
$$
\mathcal{F}(X) = \colim_F \Gamma(X, \mathcal{O}_X)
$$
for any quasi-compact and quasi-separated object $X$ of $(\Sch/S)_h$.
\end{lemma}

\begin{proof}
Denote $\mathcal{F}$ the Zariski sheafification
of the functor
$$
X \longrightarrow \colim_F \Gamma(X, \mathcal{O}_X)
$$
For quasi-compact and quasi-separated schemes $X$
we have $\mathcal{F}(X) = \colim_F \Gamma(X, \mathcal{O}_X)$.
by Sheaves, Lemma \ref{sheaves-lemma-directed-colimits-sections}
and the fact that $\mathcal{O}$ is a sheaf for the Zariski topology.
Thus it suffices to show that $\mathcal{F}$ is a h sheaf.
To prove this we check conditions (1), (2), (3), and (4) of
Lemma \ref{lemma-refine-check-h}.
Condition (1) holds because we performed an (almost unnecessary)
Zariski sheafification. Condition (2) holds because
$\mathcal{O}$ is an fppf sheaf (Descent, Lemma
\ref{descent-lemma-sheaf-condition-holds}) and if
$A$ is the equalizer of two maps $B \to C$ of $\mathbf{F}_p$-algebras,
then $\colim_F A$ is the equalizer of the two maps
$\colim_F B \to \colim_F C$.

\medskip\noindent
We check condition (3). Let $A, f, J$ be as in
Example \ref{example-one-generator}.
We have to show that
$$
\colim_F A = \colim_F A/J \times_{\colim_F A/fA + J} \colim_F A/fA
$$
This reduces to the following algebra question: suppose $a', a'' \in A$
are such that $F^n(a' - a'') \in fA + J$. Find $a \in A$ and $m \geq 0$
such that $a - F^m(a') \in J$ and $a - F^m(a'') \in fA$ and show that
the pair $(a, m)$ is uniquely determined up to a replacement of the
form $(a, m) \mapsto (F(a), m + 1)$.
To do this just write $F^n(a' - a'') = f h + g$ with $h \in A$ and $g \in J$
and set $a = F^n(a') - g = F^n(a'') + fh$ and set $m = n$.
To see uniqueness, suppose $(a_1, m_1)$ is a second solution.
By a replacement of the form given above we may assume $m = m_1$.
Then we see that $a - a_1 \in J$ and $a - a_1 \in fA$.
Since $J$ is annihilated by a power of $f$ we see that
$a - a_1$ is a nilpotent element. Hence $F^k(a - a_1)$ is zero
for some large $k$. Thus after doing more replacements we get
$a = a_1$.

\medskip\noindent
We check condition (4). Let $X, X', Z, E$ be as in
Example \ref{example-two-generators}. By
Lemma \ref{lemma-funny-blow-up} we see that
$$
\mathcal{F}(X) = \colim_F \Gamma(X, \mathcal{O}_X)
\longrightarrow
\colim_F \Gamma(X', \mathcal{O}_{X'}) = \mathcal{F}(X')
$$
is bijective. Since $E = \mathbf{P}^1_Z$ in this case we also
see that $\mathcal{F}(Z) \to \mathcal{F}(E)$ is bijective.
Thus the conclusion holds in this case as well.
\end{proof}

\noindent
Let $p$ be a prime number. For an $\mathbf{F}_p$-algebra $A$
we set $\lim_F A$ equal to the limit of the inverse system
$$
\ldots \xrightarrow{F} A \xrightarrow{F} A \xrightarrow{F} A
$$
where $F : A \to A$, $a \mapsto a^p$ is the Frobenius endomorphism.

\begin{lemma}
\label{lemma-h-sheaf-lim-F}
Let $p$ be a prime number. Let $S$ be a scheme over $\mathbf{F}_p$.
Let $(\Sch/S)_h$ be a site as in Definition \ref{definition-big-small-h}.
The rule
$$
\mathcal{F}(X) = \lim_F \Gamma(X, \mathcal{O}_X)
$$
defines a sheaf on $(\Sch/S)_h$.
\end{lemma}

\begin{proof}
To prove $\mathcal{F}$ is a sheaf, let's check conditions
(1), (2), (3), and (4) of Lemma \ref{lemma-refine-check-h}.
Condition (1) holds because limits of sheaves are sheaves
and $\mathcal{O}$ is a Zariski sheaf. Condition (2) holds because
$\mathcal{O}$ is an fppf sheaf (Descent, Lemma
\ref{descent-lemma-sheaf-condition-holds}) and if $A$ is the equalizer
of two maps $B \to C$ of $\mathbf{F}_p$-algebras, then $\lim_F A$
is the equalizer of the two maps $\lim_F B \to \lim_F C$.

\medskip\noindent
We check condition (3). Let $A, f, J$ be as in
Example \ref{example-one-generator}.
We have to show that
\begin{align*}
\lim_F A
& \to
\lim_F A/J \times_{\lim_F A/fA + J} \lim_F A/fA \\
& =
\lim_F (A/J \times_{A/fA + J} A/fA) \\
& =
\lim_F A/(fA \cap J)
\end{align*}
is bijective. Since $J$ is annihilated by a power of $f$ we see that
$\mathfrak a = fA \cap J$ is a nilpotent ideal, i.e., there exists an
$n$ such that $\mathfrak a^n = 0$. It is straightforward
to verify that in this case $\lim_F A \to \lim_F A/\mathfrak a$
is bijective.

\medskip\noindent
We check condition (4). Let $X, X', Z, E$ be as in
Example \ref{example-two-generators}. By
Lemma \ref{lemma-funny-blow-up} and the same argument as above
we see that
$$
\mathcal{F}(X) = \lim_F \Gamma(X, \mathcal{O}_X)
\longrightarrow
\lim_F \Gamma(X', \mathcal{O}_{X'}) = \mathcal{F}(X')
$$
is bijective. Since $E = \mathbf{P}^1_Z$ in this case we also
see that $\mathcal{F}(Z) \to \mathcal{F}(E)$ is bijective.
Thus the conclusion holds in this case as well.
\end{proof}

\noindent
In the following lemma we use the absolute weak normalization $X^{awn}$
of a scheme $X$, see
Morphisms, Section \ref{morphisms-section-seminormalization}.

\begin{lemma}
\label{lemma-weak-normalization-ph-sheaf}
Let $(\Sch/S)_{ph}$ be a site as in
Topologies, Definition \ref{topologies-definition-big-small-ph}.
The rule
$$
X \longmapsto \Gamma(X^{awn}, \mathcal{O}_{X^{awn}})
$$
is a sheaf on $(\Sch/S)_{ph}$.
\end{lemma}

\begin{proof}
To prove $\mathcal{F}$ is a sheaf, let's check conditions
(1) and (2) of Topologies, Lemma \ref{topologies-lemma-characterize-sheaf}.
Condition (1) holds because formation of $X^{awn}$ commutes with
open coverings, see Morphisms, Lemma \ref{morphisms-lemma-seminormalization}
and its proof.

\medskip\noindent
Let $\pi : Y \to X$ be a surjective proper morphism. We have to show
that the equalizer of the two maps
$$
\Gamma(Y^{awn}, \mathcal{O}_{Y^{awn}}) \to
\Gamma((Y \times_X Y)^{awn}, \mathcal{O}_{(Y \times_X Y)^{awn}})
$$
is equal to $\Gamma(X^{awn}, \mathcal{O}_{X^{awn}})$. Let $f$ be
an element of this equalizer. Then we consider the morphism
$$
f : Y^{awn} \longrightarrow \mathbf{A}^1_X
$$
Since $Y^{awn} \to X$ is universally closed, the scheme theoretic
image $Z$ of $f$ is a closed subscheme of $\mathbf{A}^1_X$ proper over $X$
and $f : Y^{awn} \to Z$ is surjective.
See Morphisms, Lemma \ref{morphisms-lemma-scheme-theoretic-image-is-proper}.
Thus $Z \to X$ is finite
(Morphisms, Lemma \ref{morphisms-lemma-finite-proper})
and surjective.

\medskip\noindent
Let $k$ be a field and let $z_1, z_2 : \Spec(k) \to Z$ be two
morphisms equalized by $Z \to X$. We claim that $z_1 = z_2$.
It suffices to show the images $\lambda_i = z_i^*f \in k$ agree
(as the structure sheaf of $Z$ is generated by $f$
over the structure sheaf of $X$). To see this we
choose a field extension
$K/k$ and morphisms $y_1, y_2 : \Spec(K) \to Y^{awn}$ such that
$z_i \circ (\Spec(K) \to \Spec(k)) = f \circ y_i$. This is possible
by the surjectivity of the map $Y^{awn} \to Z$. Choose an algebraically
closed extension $\Omega/k$ of very large cardinality.
For any $k$-algebra maps $\sigma_i : K \to \Omega$
we obtain
$$
\Spec(\Omega)
\xrightarrow{\sigma_1, \sigma_2}
\Spec(K \otimes_k K)
\xrightarrow{y_1, y_2}
Y^{awn} \times_X Y^{awn}
$$
Since the canonical morphism
$(Y \times_X Y)^{awn} \to Y^{awn} \times_X Y^{awn}$
is a universal homeomorphism and since $\Omega$ is algebraically closed,
we can lift the composition above uniquely to a morphism
$\Spec(\Omega) \to (Y \times_X Y)^{awn}$. Since $f$ is in the equalizer
above, this proves that $\sigma_1(\lambda_1) = \sigma_2(\lambda_2)$.
An easy lemma about field extensions shows that this implies
$\lambda_1 = \lambda_2$; details omitted.

\medskip\noindent
We conclude that $Z \to X$ is universally injective, i.e.,
$Z \to X$ is injective on points and induces
purely inseparated residue field extensions
(Morphisms, Lemma \ref{morphisms-lemma-universally-injective}).
All in all we conclude that $Z \to X$ is a universal homeomorphism, see
Morphisms, Lemma \ref{morphisms-lemma-universal-homeomorphism}.

\medskip\noindent
Let $g : X^{awn} \to Z$ be the map obtained from the universal property
of $X^{awn}$. Then $Y^{awn} \to X^{awn} \to Z$ and $f : Y^{awn} \to Z$
are two morphisms over $X$. By the universal property of
$Y^{awn} \to Y$ the two corresponding morphisms
$Y^{awn} \to Y \times_X Z$ over $Y$ have to be equal. This implies
that $g \circ \pi^{wan} = f$ as morphisms into $\mathbf{A}^1_X$
and we conclude that $g \in \Gamma(X^{awn}, \mathcal{O}_{X^{awn}})$
is the element we were looking for.
\end{proof}

\begin{lemma}
\label{lemma-weak-normalization-h-sheaf}
Let $S$ be a scheme. Choose a site $(\Sch/S)_h$
as in Definition \ref{definition-big-small-h}.
The rule
$$
X \longmapsto \Gamma(X^{awn}, \mathcal{O}_{X^{awn}})
$$
is the sheafification of the ``structure sheaf'' $\mathcal{O}$
on $(\Sch/S)_h$. Similarly for the ph topology.
\end{lemma}

\begin{proof}
In Lemma \ref{lemma-weak-normalization-ph-sheaf}
we have seen that the rule $\mathcal{F}$ of the lemma
defines a sheaf in the ph topology and hence a fortiori
a sheaf for the h topology. Clearly, there is a canonical map
of presheaves of rings $\mathcal{O} \to \mathcal{F}$.
To finish the proof, it suffices to show
\begin{enumerate}
\item if $f \in \mathcal{O}(X)$ maps to zero in $\mathcal{F}(X)$,
then there is a h covering $\{X_i \to X\}$ such that $f|_{X_i} = 0$, and
\item given $f \in \mathcal{F}(X)$ there is a h covering
$\{X_i \to X\}$ such that $f|_{X_i}$ is the image of $f_i \in \mathcal{O}(X_i)$.
\end{enumerate}
Let $f$ be as in (1). Then $f|_{X^{awn}} = 0$. This means that $f$
is locally nilpotent. Thus if $X' \subset X$ is the closed subscheme
cut out by $f$, then $X' \to X$ is a surjective closed immersion of
finite presentation. Hence $\{X' \to X\}$ is the desired h covering.
Let $f$ be as in (2). After replacing $X$ by the members of an
affine open covering we may assume $X = \Spec(A)$ is affine.
Then $f \in A^{awn}$, see
Morphisms, Lemma \ref{morphisms-lemma-seminormalization-ring}.
By Morphisms, Lemma \ref{morphisms-lemma-universal-homeo-limit}
we can find a ring map $A \to B$ of finite presentation
such that $\Spec(B) \to \Spec(A)$ is a universal homeomorphism
and such that $f$ is the image of an element $b \in B$ under
the canonical map $B \to A^{awn}$. Then
$\{\Spec(B) \to \Spec(A)\}$ is an h covering and we conclude.
The statement about the ph topology follows in the same manner
(or it can be deduced from the statement for the h topology).
\end{proof}

\noindent
Let $p$ be a prime number. An $\mathbf{F}_p$-algebra $A$ is
called {\it perfect} if the map $F : A \to A$, $x \mapsto x^p$
is an automorphism of $A$.

\begin{lemma}
\label{lemma-perfect-weankly-normal}
Let $p$ be a prime number. An $\mathbf{F}_p$-algebra $A$ is
absolutely weakly normal if and only if it is perfect.
\end{lemma}

\begin{proof}
It is immediate from condition (2)(b) in
Morphisms, Definition \ref{morphisms-definition-seminormal-ring}
that if $A$ is absolutely weakly normal, then it is perfect.

\medskip\noindent
Assume $A$ is perfect. Suppose $x, y \in A$ with $x^3 = y^2$.
If $p > 3$ then we can write $p = 2n + 3m$ for some $n, m > 0$.
Choose $a, b \in A$ with $a^p = x$ and $b^p = y$.
Setting $c = a^n b^m$ we have
$$
c^{2p} = x^{2n} y^{2m} = x^{2n + 3m} = x^p
$$
and hence $c^2 = x$. Similarly $c^3 = y$. If $p = 2$, then
write $x = a^2$ to get $a^6 = y^2$ which implies $a^3 = y$.
If $p = 3$, then write $y = a^3$ to get $x^3 = a^6$ which
implies $x = a^2$.

\medskip\noindent
Suppose $x, y \in A$ with $\ell^\ell x = y^\ell$ for some prime
number $\ell$. If $\ell \not = p$, then $a = y/\ell$ satisfies
$a^\ell = x$ and $\ell a = y$. If $\ell = p$, then
$y = 0$ and $x = a^p$ for some $a$.
\end{proof}

\begin{lemma}
\label{lemma-char-p}
Let $p$ be a prime number.
\begin{enumerate}
\item If $A$ is an $\mathbf{F}_p$-algebra, then $\colim_F A = A^{awn}$.
\item If $S$ is a scheme over $\mathbf{F}_p$, then the
h sheafification of $\mathcal{O}$ sends a quasi-compact
and quasi-separated $X$ to $\colim_F \Gamma(X, \mathcal{O}_X)$.
\end{enumerate}
\end{lemma}

\begin{proof}
Proof of (1). Observe that $A \to \colim_F A$ induces a
universal homeomorphism on spectra by
Algebra, Lemma \ref{algebra-lemma-p-ring-map}.
Thus it suffices to show that $B = \colim_F A$ is
absolutely weakly normal, see
Morphisms, Lemma \ref{morphisms-lemma-seminormalization-ring}.
Note that the ring map $F : B \to B$ is an automorphism,
in other words, $B$ is a perfect ring. Hence
Lemma \ref{lemma-perfect-weankly-normal} applies.

\medskip\noindent
Proof of (2). This follows from (1) and
Lemmas \ref{lemma-h-sheaf-colim-F} and
\ref{lemma-weak-normalization-h-sheaf}
by looking affine locally.
\end{proof}






\section{Descent vector bundles in positive characteristic}
\label{section-descent-vectorbundles-h}

\noindent
A reference for this section is \cite{Witt-Grass}.

\medskip\noindent
For a scheme $S$ let us denote $\textit{Vect}(S)$ the category
of finite locally free $\mathcal{O}_S$-modules.
Let $p$ be a prime number. Let $S$ be a quasi-compact and quasi-separated
scheme over $\mathbf{F}_p$. In this section we will work with the
category
$$
\colim_F \textit{Vect}(S) =
\colim
\left(
\textit{Vect}(S) \xrightarrow{F^*}
\textit{Vect}(S) \xrightarrow{F^*}
\textit{Vect}(S) \xrightarrow{F^*} \ldots
\right)
$$
where $F : S \to S$ is the absolute Frobenius morphism. In down
to earth terms an object of this category is a pair $(\mathcal{E}, n)$
where $\mathcal{E}$ is a finite locally free $\mathcal{O}_S$-module
and $n \geq 0$ is an integer. For morphisms we take
$$
\Hom_{\colim_F \textit{Vect}(S)}((\mathcal{E}, n), (\mathcal{G}, m)) =
\colim_N \Hom_S(F^{N - n, *}\mathcal{E}, F^{N - m, *}\mathcal{G})
$$
where $F : S \to S$ is the absolute Frobenius morphism of $S$.
Thus the object $(\mathcal{E}, n)$ is isomorphic to the object
$(F^*\mathcal{E}, n + 1)$.

\begin{lemma}
\label{lemma-colim-F-Vect}
Let $p$ be a prime number. Let $S$ be a quasi-compact and quasi-separated
scheme over $\mathbf{F}_p$. The category $\colim_F \textit{Vect}(S)$
is equivalent to the category of finite locally free modules
over the sheaf of rings $\colim_F \mathcal{O}_S$ on $S$.
\end{lemma}

\begin{proof}
Omitted.
\end{proof}

\begin{lemma}
\label{lemma-vector-bundle-I}
Let $p$ be a prime number. Consider an almost blowup square $X, X', Z, E$
in characteristic $p$ as in Example \ref{example-one-generator}.
Then the functor
$$
\colim_F \textit{Vect}(X)
\longrightarrow
\colim_F \textit{Vect}(Z)
\times_{\colim_F \textit{Vect}(E)}
\colim_F \textit{Vect}(X')
$$
is an equivalence.
\end{lemma}

\begin{proof}
Let $A, f, J$ be as in Example \ref{example-one-generator}.
Since all our schemes are affine and since we have internal
Hom in the category of vector bundles, the fully faithfulness
of the functor follows if we can show that
$$
\colim P \otimes_{A, F^N} A =
\colim P \otimes_{A, F^N} A/J
\times_{\colim P \otimes_{A, F^N} A/fA + J}
\colim P \otimes_{A, F^N} A/fA
$$
for a finite projective $A$-module $P$. After writing $P$ as a summand
of a finite free module, this follows from the case where $P$ is finite
free. This case immediately reduces to the case $P = A$. The case
$P = A$ follows from Lemma \ref{lemma-h-sheaf-colim-F}
(in fact we proved this case directly in the proof of this lemma).

\medskip\noindent
Essential surjectivity. Here we obtain the following algebra problem.
Suppose $P_1$ is a finite projective $A/J$-module,
$P_2$ is a finite projective $A/fA$-module, and
$$
\varphi :
P_1 \otimes_{A/J} A/fA + J
\longrightarrow
P_2 \otimes_{A/fA} A/fA + J
$$
is an isomorphism. Goal: show that there exists an $N$, a finite
projective $A$-module $P$, an isomorphism
$\varphi_1 : P \otimes_A A/J \to P_1 \otimes_{A/J, F^N} A/J$,
and an isomorphism
$\varphi_2 : P \otimes_A A/fA \to P_2 \otimes_{A/fA, F^N} A/fA$
compatible with $\varphi$ in an obvious manner.
This can be seen as follows. First, observe that
$$
A/(J \cap fA) = A/J \times_{A/fA + J} A/fA
$$
Hence by More on Algebra, Lemma
\ref{more-algebra-lemma-finitely-presented-module-over-fibre-product}
there is a finite projective module $P'$ over
$A/(J \cap fA)$ which comes with isomorphisms
$\varphi'_1 : P' \otimes_A A/J \to P_1$ and
$\varphi_2 : P' \otimes_A A/fA \to P_2$
compatible with $\varphi$. Since $J$ is a finitely generated ideal and
$f$-power torsion we see that $J \cap fA$ is a nilpotent
ideal. Hence for some $N$ there is a factorization
$$
A \xrightarrow{\alpha} A/(J \cap fA) \xrightarrow{\beta} A
$$
of $F^N$. Setting $P = P' \otimes_{A/(J \cap fA), \beta} A$
we conclude.
\end{proof}

\begin{lemma}
\label{lemma-vector-bundle-II}
Let $p$ be a prime number. Consider an almost blowup square $X, X', Z, E$
in characteristic $p$ as in Example \ref{example-two-generators}.
Then the functor
$$
G :
\colim_F \textit{Vect}(X)
\longrightarrow
\colim_F \textit{Vect}(Z)
\times_{\colim_F \textit{Vect}(E)}
\colim_F \textit{Vect}(X')
$$
is an equivalence.
\end{lemma}

\begin{proof}
Fully faithfulness. Suppose that $(\mathcal{E}, n)$ and
$(\mathcal{F}, m)$ are objects of $\colim_F \textit{Vect}(X)$.
Let $(a, b) : G(\mathcal{E}, n) \to G(\mathcal{F}, m)$
be a morphism in the RHS. We may choose $N \gg 0$ and
think of $a$ as a map
$a : F^{N - n, *}\mathcal{E}|_Z \to F^{N - m, *}\mathcal{F}|_Z$
and $b$ as a map
$b : F^{N - n, *}\mathcal{E}|_{X'} \to F^{N - m, *}\mathcal{F}|_{X'}$
agreeing over $E$.
Choose a finite affine open covering
$X = X_1 \cup \ldots \cup X_n$ such that $\mathcal{E}|_{X_i}$
and $\mathcal{F}|_{X_i}$ are finite free $\mathcal{O}_{X_i}$-modules.
For each $i$ the base change
$$
\xymatrix{
E_i \ar[r] \ar[d] & X'_i \ar[d] \\
Z_i \ar[r] & X_i
}
$$
is another almost blow up square as in Example \ref{example-two-generators}.
For these squares we know that
$$
\colim_F H^0(X_i, \mathcal{O}_{X_i}) =
\colim_F H^0(Z_i, \mathcal{O}_{Z_i})
\times_{\colim_F H^0(E_i, \mathcal{O}_{E_i})}
\colim_F H^0(X'_i, \mathcal{O}_{X'_i})
$$
by Lemma \ref{lemma-h-sheaf-colim-F} (see proof of the lemma).
Hence after increasing $N$ we may assume
the maps $a|_{Z_i}$ and $b|_{X'_i}$ come from
maps $c_i : F^{N - n, *}\mathcal{E}|_{X_i} \to F^{N - m, *}\mathcal{F}|_{X_i}$.
After possibly increasing $N$ we may assume $c_i$ and $c_j$
agree on $X_i \cap X_j$. Thus these maps glue to give the
desired morphism $(\mathcal{E}, n) \to (\mathcal{F}, m)$
in the LHS.

\medskip\noindent
Essential surjectivity. Let $(\mathcal{F}, \mathcal{G}, \varphi)$ be a
triple consisting of
a finite locally free $\mathcal{O}_Z$-module $\mathcal{F}$,
a finite locally free $\mathcal{O}_{X'}$-module $\mathcal{G}$, and
an isomorphism $\varphi : \mathcal{F}|_E \to \mathcal{G}|_E$.
We have to show that after replacing this triple by a Frobenius
power pullback, it comes from a finite locally free $\mathcal{O}_X$-module.

\medskip\noindent
Noetherian reduction; we urge the reader to skip this paragraph.
Recall that $X = \Spec(A)$ and $Z = \Spec(A/(f_1, f_2))$,
$X' = \text{Proj}(A[T_0, T_1]/(f_2T_0 - f_1T_1))$, and
$E = \mathbf{P}^1_Z$. By Limits, Lemma
\ref{limits-lemma-descend-invertible-modules}
we can find a finitely generated $\mathbf{F}_p$-subalgebra
$A_0 \subset A$ containing $f_1$ and $f_2$ such that the triple
$(\mathcal{F}, \mathcal{G}, \varphi)$ descends to
$X_0 = \Spec(A_0)$ and $Z_0 = \Spec(A_0/(f_1, f_2))$,
$X_0' = \text{Proj}(A_0[T_0, T_1]/(f_2T_0 - f_1T_1))$, and
$E_0 = \mathbf{P}^1_{Z_0}$. Thus we may assume our schemes
are Noetherian.

\medskip\noindent
Assume $X$ is Noetherian. We may choose a finite affine open covering
$X = X_1 \cup \ldots \cup X_n$ such that $\mathcal{F}|_{Z \cap X_i}$ is free.
Since we can glue objects of $\colim_F \textit{Vect}(X)$
in the Zariski topology (Lemma \ref{lemma-colim-F-Vect}), and
since we already know
fully faithfulness over $X_i$ and $X_i \cap X_j$ (see first paragraph
of the proof), it suffices to prove the existence over each $X_i$.
This reduces us to the case discussed in the next paragraph.

\medskip\noindent
Assume $X$ is Noetherian and $\mathcal{F} = \mathcal{O}_Z^{\oplus r}$.
Using $\varphi$ we get an isomorphism
$\mathcal{O}_E^{\oplus r} \to \mathcal{G}|_E$.
Let $I = (f_1, f_2) \subset A$.
Let $\mathcal{I} \subset \mathcal{O}_{X'}$
be the ideal sheaf of $E$; it is globally generated by $f_1$ and $f_2$.
For any $n$ there is a surjection
$$
(\mathcal{I}^n/\mathcal{I}^{n + 1})^{\oplus r} =
\mathcal{I}^n/\mathcal{I}^{n + 1} \otimes_{\mathcal{O}_E}
\mathcal{G}|_E \longrightarrow
\mathcal{I}^n\mathcal{G}/\mathcal{I}^{n + 1}\mathcal{G}
$$
Hence the first cohomology group of this module is zero.
Here we use that $E = \mathbf{P}^1_Z$ and hence its structure
sheaf and in fact any globally generated quasi-coherent module
has vanishing $H^1$. Compare with More on Morphisms, Lemma
\ref{more-morphisms-lemma-globally-generated-vanishing}.
Then using the short exact sequences
$$
0 \to  \mathcal{I}^n\mathcal{G}/\mathcal{I}^{n + 1}\mathcal{G} \to
\mathcal{G}/\mathcal{I}^{n + 1}\mathcal{G} \to
\mathcal{G}/\mathcal{I}^n\mathcal{G} \to 0
$$
and induction, we see that
$$
\lim H^0(X', \mathcal{G}/\mathcal{I}^n\mathcal{G})
\to
H^0(E, \mathcal{G}|_E) = H^0(E, \mathcal{O}_E^{\oplus r}) =
A/I^{\oplus r}
$$
is surjective. By the theorem on formal functions
(Cohomology of Schemes, Theorem \ref{coherent-theorem-formal-functions})
this implies that
$$
H^0(X', \mathcal{G}) \to
H^0(E, \mathcal{G}|_E) = H^0(E, \mathcal{O}_E^{\oplus r}) =
A/I^{\oplus r}
$$
is surjective. Thus we can choose a map
$\alpha : \mathcal{O}_{X'}^{\oplus r} \to \mathcal{G}$
which is compatible with the given trivialization
of $\mathcal{G}|_E$. Thus $\alpha$ is an isomorphism over
an open neighbourhood of $E$ in $X'$. Thus every point
of $Z$ has an affine open neighbourhood where
we can solve the problem. Since $X' \setminus E \to X \setminus Z$
is an isomorphism, the same holds for points of $X$ not in $Z$.
Thus another Zariski glueing argument finishes the proof.
\end{proof}

\begin{proposition}
\label{proposition-h-descent-vector-bundles-p}
Let $p$ be a prime number. Let $S$ be a scheme in characteristic $p$.
Then the category fibred in groupoids
$$
p : \mathcal{S} \longrightarrow (\Sch/S)_h
$$
whose fibre category over $U$ is the category
of finite locally free $\colim_F \mathcal{O}_U$-modules over $U$
is a stack in groupoids. Moreover, if $U$ is quasi-compact
and quasi-separated, then $\mathcal{S}_U$ is $\colim_F \textit{Vect}(U)$.
\end{proposition}

\begin{proof}
The final assertion is the content of Lemma \ref{lemma-colim-F-Vect}.
To prove the proposition we will check conditions (1), (2), and (3) of
Lemma \ref{lemma-refine-check-h-stack}.

\medskip\noindent
Condition (1) holds because by definition we have glueing
for the Zariski topology.

\medskip\noindent
To see condition (2), suppose that $f : X \to Y$ is a surjective,
flat, proper morphism of finite presentation over $S$ with $Y$ affine.
Since $Y, X, X \times_Y X$ are quasi-compact and quasi-separated,
we can use the description of fibre categories given in the
statement of the proposition. Then it is clearly enough to
show that
$$
\textit{Vect}(Y)
\longrightarrow
\textit{Vect}(X)
\times_{\textit{Vect}(X \times_Y X)}
\textit{Vect}(X)
$$
is an equivalence (as this will imply the same for the colimits).
This follows immediately from fppf descent of finite locally free modules, see
Descent, Proposition \ref{descent-proposition-fpqc-descent-quasi-coherent} and
Lemma \ref{descent-lemma-finite-locally-free-descends}.

\medskip\noindent
Condition (3) is the content of
Lemmas \ref{lemma-vector-bundle-I} and \ref{lemma-vector-bundle-II}.
\end{proof}

\begin{lemma}
\label{lemma-trivial-fibres-dvr}
Let $f : X \to S$ be a proper morphism with geometrically connected fibres
where $S$ is the spectrum of a discrete valuation ring. Denote $\eta \in S$
the generic point and denote $X_n \subset X$ the closed subscheme
cutout by the $n$th power of a uniformizer on $S$.
Then there exists
an integer $n$ such that the following is true: any finite
locally free $\mathcal{O}_X$-module $\mathcal{E}$
such that $\mathcal{E}|_{X_\eta}$ and $\mathcal{E}|_{X_n}$
are free, is free.
\end{lemma}

\begin{proof}
We first reduce to the case where $X \to S$ has a section. Say $S = \Spec(A)$.
Choose a closed point $\xi$ of $X_\eta$. Choose an extension
of discrete valuation rings $A \subset B$ such that the fraction field
of $B$ is $\kappa(\xi)$. This is possible by Krull-Akizuki
(Algebra, Lemma \ref{algebra-lemma-integral-closure-Dedekind})
and the fact that $\kappa(\xi)$ is a finite extension of the
fraction field of $A$.
By the valuative criterion of properness
(Morphisms, Lemma \ref{morphisms-lemma-characterize-proper})
we get a $B$-valued point $\tau : \Spec(B) \to X$
which induces a section $\sigma : \Spec(B) \to X_B$.
For a finite locally free $\mathcal{O}_X$-module $\mathcal{E}$
let $\mathcal{E}_B$ be the pullback to the base change $X_B$.
By flat base change
(Cohomology of Schemes, Lemma \ref{coherent-lemma-flat-base-change-cohomology})
we see that $H^0(X_B, \mathcal{E}_B) = H^0(X, \mathcal{E}) \otimes_A B$.
Thus if $\mathcal{E}_B$ is free of rank $r$, then the sections in
$H^0(X, \mathcal{E})$ generate the free $B$-module
$\tau^*\mathcal{E} = \sigma^*\mathcal{E}_B$.
In particular, we can find $r$ global sections $s_1, \ldots, s_r$
of $\mathcal{E}$ which generate $\tau^*\mathcal{E}$. Then
$$
s_1, \ldots, s_r :
\mathcal{O}_X^{\oplus r}
\longrightarrow
\mathcal{E}
$$
is a map of finite locally free $\mathcal{O}_X$-modules of rank $r$
and the pullback to $X_B$ is a map of free $\mathcal{O}_{X_B}$-modules
which restricts to an isomorphism in one point of each fibre.
Taking the determinant we get a function
$g \in \Gamma(X_\eta, \mathcal{O}_{X_B})$
which is invertible in one point of each fibre.
As the fibres are proper and connected, we see that $g$
must be invertible (details omitted; hint: use Varieties, Lemma
\ref{varieties-lemma-proper-geometrically-reduced-global-sections}).
Thus it suffices to prove the lemma for the base change $X_B \to \Spec(B)$.

\medskip\noindent
Assume we have a section $\sigma : S \to X$. Let $\mathcal{E}$
be a finite locally free $\mathcal{O}_X$-module which is assumed
free on the generic fibre and on $X_n$ (we will choose $n$ later).
Choose an isomorphism $\sigma^*\mathcal{E} = \mathcal{O}_S^{\oplus r}$.
Consider the map
$$
K = R\Gamma(X, \mathcal{E}) \longrightarrow
R\Gamma(S, \sigma^*\mathcal{E}) = A^{\oplus r}
$$
in $D(A)$. Arguing as above, we see $\mathcal{E}$ is free if (and only if)
the induced map $H^0(K) = H^0(X, \mathcal{E}) \to A^{\oplus r}$ is surjective.

\medskip\noindent
Set $L = R\Gamma(X, \mathcal{O}_X^{\oplus r})$ and observe that the
corresponding map $L \to A^{\oplus r}$ has the desired property.
Observe that $K \otimes_A Q(A) \cong L \otimes_A Q(A)$
by flat base change and the assumption that $\mathcal{E}$
is free on the generic fibre. Let $\pi \in A$ be a uniformizer. Observe that
$$
K \otimes_A^\mathbf{L} A/\pi^m A =
R\Gamma(X, \mathcal{E} \xrightarrow{\pi^m} \mathcal{E})
$$
and similarly for $L$.
Denote $\mathcal{E}_{tors} \subset \mathcal{E}$ the coherent subsheaf of
sections supported on the special fibre and similarly for other
$\mathcal{O}_X$-modules. Choose $k > 0$ such that
$(\mathcal{O}_X)_{tors} \to \mathcal{O}_X/\pi^k \mathcal{O}_X$
is injective (Cohomology of Schemes, Lemma \ref{coherent-lemma-Artin-Rees}).
Since $\mathcal{E}$ is locally free, we see
that $\mathcal{E}_{tors} \subset \mathcal{E}/\pi^k\mathcal{E}$.
Then for $n \geq m + k$ we have isomorphisms
\begin{align*}
(\mathcal{E} \xrightarrow{\pi^m} \mathcal{E})
& \cong
(\mathcal{E}/\pi^k\mathcal{E} \xrightarrow{\pi^m}
\mathcal{E}/\pi^{k + m}\mathcal{E}) \\
& \cong
(\mathcal{O}_X^{\oplus r}/\pi^k\mathcal{O}_X^{\oplus r} \xrightarrow{\pi^m}
\mathcal{O}_X^{\oplus r}/\pi^{k + m}\mathcal{O}_X^{\oplus r}) \\
& \cong
(\mathcal{O}_X^{\oplus r} \xrightarrow{\pi^m} \mathcal{O}_X^{\oplus r})
\end{align*}
in $D(\mathcal{O}_X)$. This determines an isomorphism
$$
K \otimes_A^\mathbf{L} A/\pi^m A \cong L \otimes_A^\mathbf{L} A/\pi^m A
$$
in $D(A)$ (holds when $n \geq m + k$). Observe that these isomorphisms
are compatible with pulling back by $\sigma$ hence in particular
we conclude that
$K \otimes_A^\mathbf{L} A/\pi^m A \to (A/\pi^m A)^{\oplus r}$
defines an surjection on degree $0$ cohomology modules (as
this is true for $L$).
Since $A$ is a discrete valuation ring, we have
$$
K \cong \bigoplus H^i(K)[-i]
\quad\text{and}\quad
L \cong
\bigoplus H^i(L)[-i]
$$
in $D(A)$. See More on Algebra, Example
\ref{more-algebra-example-finite-injective-finite-global-dimension}.
The cohomology groups $H^i(K) = H^i(X, \mathcal{E})$ and
$H^i(L) = H^i(X, \mathcal{O}_X)^{\oplus r}$
are finite $A$-modules by Cohomology of Schemes, Lemma
\ref{coherent-lemma-proper-over-affine-cohomology-finite}.
By More on Algebra, Lemma
\ref{more-algebra-lemma-generalized-valuation-ring-modules}
these modules are direct sums of cyclic modules.
We have seen above that the rank $\beta_i$ of the
free part of $H^i(K)$ and $H^i(L)$ are the same.
Next, observe that
$$
H^i(L \otimes_A^\mathbf{L} A/\pi^m A) =
H^i(L)/\pi^m H^i(L) \oplus H^{i + 1}(L)[\pi^m]
$$
and similarly for $K$. Let $e$ be the largest integer
such that $A/\pi^eA$ occurs as a summand of $H^i(X, \mathcal{O}_X)$,
or equivalently $H^i(L)$, for some $i$. Then taking $m = e + 1$
we see that $H^i(L \otimes_A^\mathbf{L} A/\pi^m A)$ is a direct sum of
$\beta_i$ copies of $A/\pi^m A$ and some other cyclic modules
each annihilated by $\pi^e$. By the same reasoning for $K$
and the isomorphism
$K \otimes_A^\mathbf{L} A/\pi^m A \cong L \otimes_A^\mathbf{L} A/\pi^m A$
it follows that $H^i(K)$
cannot have any cyclic summands of the form $A/\pi^l A$
with $l > e$. (It also follows that $K$ is isomorphic to $L$
as an object of $D(A)$, but we won't need this.)
Then the only way the map
$$
H^0(K \otimes^\mathbf{L}_A A/\pi^{e + 1} A) =
H^0(K)/\pi^{e + 1}H^0(K) \oplus H^1(K)[\pi^{e + 1}]
\longrightarrow
(A/\pi^{e + 1} A)^{\oplus r}
$$
is surjective, is if it is surjective on the
first summand. This is what we wanted to show.
(To be precise, the integer $n$ in the statement of
the lemma, if there is a section $\sigma$,
should be equal to $k + e + 1$ where $k$ and $e$ are as above
and depend only on $X$.)
\end{proof}

\begin{lemma}
\label{lemma-trivial-over-dvrs}
Let $f : X \to S$ be a morphism of schemes.
Let $\mathcal{E}$ be a finite locally free $\mathcal{O}_X$-module.
Assume
\begin{enumerate}
\item $f$ is flat and proper and $\mathcal{O}_S = f_*\mathcal{O}_X$,
\item $S$ is a normal Noetherian scheme,
\item the pullback of $\mathcal{E}$ to $X \times_S \Spec(\mathcal{O}_{S, s})$
is free for every codimension $1$ point $s \in S$.
\end{enumerate}
Then $\mathcal{E}$ is isomorphic to the pullback of a finite
locally free $\mathcal{O}_S$-module.
\end{lemma}

\begin{proof}
We will prove the canonical map
$$
\Phi : f^*f_*\mathcal{E} \longrightarrow \mathcal{E}
$$
is an isomorphism. By flat base change (Cohomology of Schemes, Lemma
\ref{coherent-lemma-flat-base-change-cohomology})
and assumptions (1) and (3) we see that
the pullback of this to $X \times_S \Spec(\mathcal{O}_{S, s})$
is an isomorphism for every codimension $1$ point $s \in S$.
By Divisors, Lemma \ref{divisors-lemma-check-isomorphism-via-depth-and-ass}
it suffices to prove that $\text{depth}((f^*f_*\mathcal{E})_x) \geq 2$
for any point $x \in X$ mapping to a point $s \in S$ of codimension $\geq 2$.
Since $f$ is flat and
$(f^*f_*\mathcal{E})_x = (f_*\mathcal{E})_s \otimes_{\mathcal{O}_{S, s}}
\mathcal{O}_{X, x}$, it suffices to prove that
$\text{depth}((f_*\mathcal{E})_s) \geq 2$, see
Algebra, Lemma \ref{algebra-lemma-apply-grothendieck}.
Since $S$ is a normal Noetherian scheme
and $\dim(\mathcal{O}_{S, s}) \geq 2$
we have $\text{depth}(\mathcal{O}_{S, s}) \geq 2$, see
Properties, Lemma \ref{properties-lemma-criterion-normal}.
Thus we get what we want from
Divisors, Lemma \ref{divisors-lemma-depth-pushforward}.
\end{proof}

\noindent
We can use the results above to prove the following
miraculous statement.

\begin{theorem}
\label{theorem-pullback-trivial-fibres}
Let $p$ be a prime number. Let $Y$ be a quasi-compact and quasi-separated
scheme over $\mathbf{F}_p$.
Let $f : X \to Y$ be a proper, surjective morphism of finite presentation
with geometrically connected fibres.
Then the functor
$$
\colim_F \textit{Vect}(Y) \longrightarrow \colim_F \textit{Vect}(X)
$$
is fully faithful with essential image described as follows.
Let $\mathcal{E}$ be a finite locally free $\mathcal{O}_X$-module.
Assume for all $y \in Y$ there exists integers $n_y, r_y \geq 0$
such that
$$
F^{n_y, *}\mathcal{E}|_{X_{y, red}}
\cong
\mathcal{O}_{X_{y, red}}^{\oplus r_y}
$$
Then for some $n \geq 0$ the $n$th Frobenius power pullback
$F^{n, *}\mathcal{E}$ is the pullback of a finite locally free
$\mathcal{O}_Y$-module.
\end{theorem}

\begin{proof}
Proof of fully faithfulness. Since vectorbundles on $Y$ are locally
trivial, this reduces to the statement that
$$
\colim_F \Gamma(Y, \mathcal{O}_Y)
\longrightarrow
\colim_F \Gamma(X, \mathcal{O}_X)
$$
is bijective. Since $\{X \to Y\}$ is an h covering, this will
follow from Lemma \ref{lemma-h-sheaf-colim-F} if we can show that the two maps
$$
\colim_F \Gamma(X, \mathcal{O}_X)
\longrightarrow
\colim_F \Gamma(X \times_Y X, \mathcal{O}_{X \times_Y X})
$$
are equal. Let $g \in \Gamma(X, \mathcal{O}_X)$
and denote $g_1$ and $g_2$ the two pullbacks of $g$ to $X \times_Y X$.
Since $X_{y, red}$ is geometrically connected, we
see that $H^0(X_{y, red}, \mathcal{O}_{X_{y, red}})$ is
a purely inseparable extension of $\kappa(y)$, see
Varieties, Lemma
\ref{varieties-lemma-proper-geometrically-reduced-global-sections}.
Thus $g^q|_{X_{y, red}}$ comes from an element of
$\kappa(y)$ for some $p$-power $q$ (which may depend on $y$).
It follows that $g_1^q$ and $g_2^q$ map to the same
element of the residue field at any point of
$(X \times_Y X)_y = X_y \times_y X_y$.
Hence $g_1 - g_2$ restricts to zero on $(X \times_Y X)_{red}$.
Hence $(g_1 - g_2)^n = 0$ for some $n$ which we may take
to be a $p$-power as desired.

\medskip\noindent
Description of essential image. Let $\mathcal{E}$ be as in the statement
of the proposition. We first reduce to the Noetherian case.

\medskip\noindent
Let $y \in Y$ be a point and view it as a morphism
$y \to Y$ from the spectrum of the residue field into $Y$.
We can write $y \to Y$ as a filtered limit of morphisms $Y_i \to Y$ of
finite presentation with $Y_i$ affine. (It is best to prove this
yourself, but it also follows formally from
Limits, Lemma \ref{limits-lemma-relative-approximation} and
\ref{limits-lemma-limit-affine}.)
For each $i$ set $Z_i = Y_i \times_Y X$. Then $X_y = \lim Z_i$
and $X_{y, red} = \lim Z_{i, red}$.
By Limits, Lemma \ref{limits-lemma-descend-modules-finite-presentation}
we can find an $i$ such that
$F^{n_y, *}\mathcal{E}|_{Z_{i, red}} \cong
\mathcal{O}_{Z_{i, red}}^{\oplus r_y}$.
Fix $i$.
We have $Z_{i, red} = \lim Z_{i, j}$ where $Z_{i, j} \to Z_i$
is a thickening of finite presentation (Limits, Lemma
\ref{limits-lemma-closed-is-limit-closed-and-finite-presentation}).
Using the same lemma as before we can find a $j$ such that
$F^{n_y, *}\mathcal{E}|_{Z_{i, j}} \cong \mathcal{O}_{Z_{i, j}}^{\oplus r_y}$.
We conclude that for each $y \in Y$ there exists a morphism
$Y_y \to Y$ of finite presentation whose image contains $y$
and a thickening $Z_y \to Y_y \times_Y X$ such that
$F^{n_y, *}\mathcal{E}|_{Z_y} \cong \mathcal{O}_{Z_y}^{\oplus r_y}$.
Observe that the image of $Y_y \to Y$ is constructible
(Morphisms, Lemma \ref{morphisms-lemma-chevalley}).
Since $Y$ is quasi-compact in the constructible topology
(Topology, Lemma \ref{topology-lemma-constructible-hausdorff-quasi-compact} and
Properties, Lemma \ref{properties-lemma-quasi-compact-quasi-separated-spectral})
we conclude that there are a finite number of morphisms
$$
Y_1 \to Y,\ Y_2 \to Y,\ \ldots,\ Y_N \to Y
$$
of finite presentation such that $Y = \bigcup \Im(Y_a \to Y)$
set theoretically and such that for each $a \in \{1, \ldots, N\}$
there exist integers $n_a, r_a \geq 0$ and there is a thickening
$Z_a \subset Y_a \times_Y X$ of finite presentation such that
$F^{n_a, *}\mathcal{E}|_{Z_a} \cong \mathcal{O}_{Z_a}^{\oplus r_a}$.

\medskip\noindent
Formulated in this way, the condition descends to an absolute
Noetherian approximation. We strongly urge the reader to skip
this paragraph. First write $Y = \lim_{i \in I} Y_i$ as a cofiltered limit
of schemes of finite type over $\mathbf{F}_p$ with affine transition
morphisms (Limits, Lemma \ref{limits-lemma-relative-approximation}).
Next, we can assume we have proper morphisms $f_i : X_i \to Y_i$
whose base change to $Y$ recovers $f : X \to Y$, see
Limits, Lemma \ref{limits-lemma-descend-finite-presentation}.
After increasing $i$ we may assume there exists a finite locally
free $\mathcal{O}_{X_i}$-module $\mathcal{E}_i$ whose pullback
to $X$ is isomorphic to $\mathcal{E}$, see
Limits, Lemma \ref{limits-lemma-descend-invertible-modules}.
Pick $0 \in I$ and denote $E \subset Y_0$ the constructible subset
where the geometric fibres of $f_0$ are connected, see
More on Morphisms, Lemma
\ref{more-morphisms-lemma-nr-geom-connected-components-constructible}.
Then $Y \to Y_0$ maps into $E$, see
More on Morphisms, Lemma
\ref{more-morphisms-lemma-base-change-fibres-geometrically-connected}.
Thus $Y_i \to Y_0$ maps into $E$ for $i \gg 0$, see
Limits, Lemma \ref{limits-lemma-limit-contained-in-constructible}.
Hence we see that the fibres of $f_i$ are geometrically connected
for $i \gg 0$. By Limits, Lemma \ref{limits-lemma-descend-finite-presentation}
for large enough $i$ we can find morphisms
$Y_{i, a} \to Y_i$ of finite type whose base change to $Y$
recovers $Y_a \to Y$, $a  \in \{1, \ldots, N\}$.
After possibly increasing $i$ we can find thickenings
$Z_{i, a} \subset Y_{i, a} \times_{Y_i} X_i$ whose base change
to $Y_a \times_Y X$ recovers $Z_a$ (same reference as before
combined with
Limits, Lemmas
\ref{limits-lemma-descend-closed-immersion-finite-presentation} and
\ref{limits-lemma-descend-surjective}).
Since $Z_a = \lim Z_{i, a}$ we find that after increasing $i$ we may assume
$F^{n_a, *}\mathcal{E}_i|_{Z_{i, a}} \cong
\mathcal{O}_{Z_{i, a}}^{\oplus r_a}$, see
Limits, Lemma \ref{limits-lemma-descend-modules-finite-presentation}.
Finally, after increasing $i$ one more time we may assume
$\coprod Y_{i, a} \to Y_i$ is surjective by
Limits, Lemma \ref{limits-lemma-descend-surjective}.
At this point all the assumptions hold for $X_i \to Y_i$
and $\mathcal{E}_i$ and we see that it suffices to prove result
for $X_i \to Y_i$ and $\mathcal{E}_i$.

\medskip\noindent
Assume $Y$ is of finite type over $\mathbf{F}_p$.
To prove the result we will use induction on $\dim(Y)$.
We are trying to find an object of
$\colim_F \textit{Vect}(Y)$ which pulls back to the
object of $\colim_F \textit{Vect}(X)$ determined by $\mathcal{E}$.
By the fully faithfulness already proven and because of
Proposition \ref{proposition-h-descent-vector-bundles-p}
it suffices to construct a descent of $\mathcal{E}$
after replacing $Y$ by the members of a h covering
and $X$ by the corresponding base change. This means
that we may replace $Y$ by a scheme proper and surjective
over $Y$ provided this does not increase the dimension of $Y$.
If $T \subset T'$ is a thickening of schemes of finite type
over $\mathbf{F}_p$ then
$\colim_F \textit{Vect}(T) = \colim_F \textit{Vect}(T')$
as $\{T \to T'\}$ is a h covering such that $T \times_{T'} T = T$.
If $T' \to T$ is a universal homeomorphism of schemes
of finite type over $\mathbf{F}_p$, then
$\colim_F \textit{Vect}(T) = \colim_F \textit{Vect}(T')$
as $\{T \to T'\}$ is a h covering such that the diagonal
$T \subset T \times_{T'} T$ is a thickening.

\medskip\noindent
Using the general remarks made above, we may and do replace
$X$ by its reduction and we may assume $X$ is reduced.
Consider the Stein factorization $X \to Y' \to Y$, see
More on Morphisms, Theorem
\ref{more-morphisms-theorem-stein-factorization-Noetherian}.
Then $Y' \to Y$ is a universal homeomorphism
of schemes of finite type over $\mathbf{F}_p$.
By the above we may replace $Y$ by $Y'$.
Thus we may assume $f_*\mathcal{O}_X = \mathcal{O}_Y$
and that $Y$ is reduced. This reduces us to the case discussed
in the next paragraph.

\medskip\noindent
Assume $Y$ is reduced and $f_*\mathcal{O}_X = \mathcal{O}_Y$
over a dense open subscheme of $Y$.
Then $X \to Y$ is flat over a dense open
subscheme $V \subset Y$, see
Morphisms, Proposition \ref{morphisms-proposition-generic-flatness-reduced}.
By Lemma \ref{lemma-flat-after-blowing-up}
there is a $V$-admissible blowing up $Y' \to Y$ such that
the strict transform $X'$ of $X$ is flat over $Y'$.
Observe that $\dim(Y') = \dim(Y)$ as $Y$ and $Y'$ have
a common dense open subscheme. By More on Morphisms, Lemma
\ref{more-morphisms-lemma-proper-flat-nr-geom-conn-comps-lower-semicontinuous}
and the fact that $V \subset Y'$ is dense
all fibres of $f' : X' \to Y'$ are geometrically connected.
We still have $(f'_*\mathcal{O}_{X'})|_V = \mathcal{O}_V$.
Write
$$
Y' \times_Y X = X' \cup E \times_Y X
$$
where $E \subset Y'$ is the exceptional divisor of the blowing up.
By the general remarks above, it suffices to prove existence
for $Y' \times_Y X \to Y'$ and the restriction of $\mathcal{E}$
to $Y' \times_Y X$.
Suppose that we find some object $\xi'$ in $\colim_F \textit{Vect}(Y')$
pulling back to the restriction of $\mathcal{E}$ to $X'$ (viewed
as an object of the colimit category).
By induction on $\dim(Y)$ we can find an object $\xi''$ in
$\colim_F \textit{Vect}(E)$ pulling back to the restriction of
$\mathcal{E}$ to $E \times_Y X$. Then the fully faithfullness
determines a unique isomorphism $\xi'|_E \to \xi''$
compatible with the given identifications with the restriction
of $\mathcal{E}$ to $E \times_{Y'} X'$. Since
$$
\{E \times_Y X \to Y' \times_Y X, X' \to Y' \times_Y X\}
$$
is a h covering given by a pair of closed immersions with
$$
(E \times_Y X) \times_{(Y' \times_Y X)} X' = E \times_{Y'} X'
$$
we conclude that $\xi'$ pulls back to the restriction of
$\mathcal{E}$ to $Y' \times_Y X$. Thus it suffices to find
$\xi'$ and we reduce to the case discussed in the next paragraph.

\medskip\noindent
Assume $Y$ is reduced, $f$ is flat, and $f_*\mathcal{O}_X = \mathcal{O}_Y$
over a dense open subscheme of $Y$. In this case we consider the
normalization $Y^\nu \to Y$ (Morphisms, Section
\ref{morphisms-section-normalization}). This is a finite surjective
morphism
(Morphisms, Lemma \ref{morphisms-lemma-nagata-normalization} and
\ref{morphisms-lemma-ubiquity-nagata}) which is an isomorphism
over a dense open. Hence by our general remarks we may
replace $Y$ by $Y^\nu$ and $X$ by $Y^\nu \times_Y X$.
After this replacement we see that $\mathcal{O}_Y = f_*\mathcal{O}_X$
(because the Stein factorization has to be an isomorphism
in this case; small detail omitted).

\medskip\noindent
Assume $Y$ is a normal Noetherian scheme, that $f$ is flat, and
that $f_*\mathcal{O}_X = \mathcal{O}_Y$. After replacing $\mathcal{E}$
by a suitable Frobenius power pullback, we may assume $\mathcal{E}$
is trivial on the scheme theoretic fibres of $f$ at the generic points
of the irreducible components of $Y$ (because
$\colim_F \textit{Vect}(-)$ is an equivalence on universal
homeomorphisms, see above). Similarly to the arguments above
(in the reduction to the Noetherian case) we conclude there is a dense
open subscheme $V \subset Y$ such that $\mathcal{E}|_{f^{-1}(V)}$ is free.
Let $Z \subset Y$ be a closed subscheme such that
$Y = V \amalg Z$ set theoretically. Let $z_1, \ldots, z_t \in Z$
be the generic points of the irreducible components of $Z$
of codimension $1$. Then $A_i = \mathcal{O}_{Y, z_i}$ is
a discrete valuation ring. Let $n_i$ be the integer found in
Lemma \ref{lemma-trivial-fibres-dvr} for the scheme $X_{A_i}$ over $A_i$.
After replacing $\mathcal{E}$ by a suitable Frobenius
power pullback, we may assume $\mathcal{E}$ is free over
$X_{A_i/\mathfrak m_i^{n_i}}$ (again because the colimit category
is invariant under universal homeomorphisms, see above).
Then Lemma \ref{lemma-trivial-fibres-dvr} tells us that
$\mathcal{E}$ is free on $X_{A_i}$.
Thus finally we conclude by applying Lemma \ref{lemma-trivial-over-dvrs}.
\end{proof}










\section{Blowing up complexes}
\label{section-blowup-complexes}

\noindent
This section finds normal forms for perfect objects of the derived category
after blowups.

\begin{lemma}
\label{lemma-fitting-ideals-complex}
Let $X$ be a scheme. Let $E \in D(\mathcal{O}_X)$ be pseudo-coherent.
For every $p, k \in \mathbf{Z}$ there is an finite type quasi-coherent
sheaf of ideals $\text{Fit}_{p, k}(E) \subset \mathcal{O}_X$
with the following property: for $U \subset X$ open
such that $E|_U$ is isomorphic to
$$
\ldots \to
\mathcal{O}_U^{\oplus n_{b - 2}}
\xrightarrow{d_{b - 2}}
\mathcal{O}_U^{\oplus n_{b - 1}}
\xrightarrow{d_{b - 1}}
\mathcal{O}_U^{\oplus n_b} \to 0 \to \ldots
$$
the restriction $\text{Fit}_{p, k}(E)|_U$ is generated by the
minors of the matrix of $d_p$ of size
$$
- k + n_{p + 1} - n_{p + 2} + \ldots + (-1)^{b - p + 1} n_b
$$
Convention: the ideal generated by $r \times r$-minors
is $\mathcal{O}_U$ if $r \leq 0$ and the ideal generated by
$r \times r$-minors where $r > \min(n_p, n_{p + 1})$ is zero.
\end{lemma}

\begin{proof}
Observe that $E$ locally on $X$ has the shape as stated in the lemma, see
More on Algebra, Section \ref{more-algebra-section-pseudo-coherent},
Cohomology, Section \ref{cohomology-section-pseudo-coherent}, and
Derived Categories of Schemes, Section \ref{perfect-section-spell-out}.
Thus it suffices to prove that the ideal of minors is independent
of the chosen representative. To do this, it suffices to check
in local rings. Over a local ring $(R, \mathfrak m, \kappa)$
consider a bounded above complex
$$
F^\bullet :
\ldots \to
R^{\oplus n_{b - 2}}
\xrightarrow{d_{b - 2}}
R^{\oplus n_{b - 1}}
\xrightarrow{d_{b - 1}}
R^{\oplus n_b} \to 0 \to \ldots
$$
Denote $\text{Fit}_{k, p}(F^\bullet) \subset R$ the ideal generated
by the minors of size $k - n_{p + 1} + n_{p + 2} - \ldots + (-1)^{b - p} n_b$
in the matrix of $d_p$. Suppose some matrix coefficient of some
differential of $F^\bullet$ is invertible. Then we pick a largest
integer $i$ such that $d_i$ has an invertible matrix coefficient.
By Algebra, Lemma \ref{algebra-lemma-add-trivial-complex}
the complex $F^\bullet$ is isomorphic to a direct sum of a trivial complex
$\ldots \to 0 \to R \to R \to 0 \to \ldots$ with nonzero terms
in degrees $i$ and $i + 1$ and a complex $(F')^\bullet$.
We leave it to the reader to see that
$\text{Fit}_{p, k}(F^\bullet) = \text{Fit}_{p, k}((F')^\bullet)$;
this is where the formula for the size of the minors is used.
If $(F')^\bullet$ has another differential with an invertible
matrix coefficient, we do it again, etc.
Continuing in this manner, we eventually reach a complex $(F^\infty)^\bullet$
all of whose differentials have matrices with coefficients
in $\mathfrak m$. Here you may have to do an infinite number
of steps, but for any cutoff only a finite number of these
steps affect the complex in degrees $\geq $ the cutoff.
Thus the ``limit'' $(F^\infty)^\bullet$ is a well defined bounded
above complex of finite free modules, comes equipped
with a quasi-isomorphism $(F^\infty)^\bullet \to F^\bullet$
into the complex we started with, and
$\text{Fit}_{p, k}(F^\bullet) = \text{Fit}_{p, k}((F^\infty)^\bullet)$.
Since the complex $(F^\infty)^\bullet$ is unique up to isomorphism by
More on Algebra, Lemma
\ref{more-algebra-lemma-lift-pseudo-coherent-from-residue-field}
the proof is complete.
\end{proof}

\begin{lemma}
\label{lemma-blowup-complex}
Let $X$ be a scheme. Let $E \in D(\mathcal{O}_X)$ be perfect.
Let $U \subset X$ be a scheme theoretically dense open subscheme
such that $H^i(E|_U)$ is finite locally free of constant rank $r_i$
for all $i \in \mathbf{Z}$.
Then there exists a $U$-admissible blowup $b : X' \to X$ such that
$H^i(Lb^*E)$ is a perfect $\mathcal{O}_{X'}$-module
of tor dimension $\leq 1$ for all $i \in \mathbf{Z}$.
\end{lemma}

\begin{proof}
We will construct and study the blowup affine locally. Namely, suppose that
$V \subset X$ is an affine open subscheme such that
$E|_V$ can be represented by the complex
$$
\mathcal{O}_V^{\oplus n_a} \xrightarrow{d_a}
\ldots \xrightarrow{d_{b - 1}} \mathcal{O}_V^{\oplus n_b}
$$
Set $k_ i = r_{i + 1} - r_{i + 2} + \ldots + (-1)^{b - i + 1}r_b$.
A computation which we omit show that over $U \cap V$ the rank of
$d_i$ is
$$
\rho_i = - k_i + n_{i + 1} - n_{i + 2} + \ldots + (-1)^{b - i + 1}n_b
$$
in the sense that the cokernel of $d_i$ is finite locally
free of rank $n_{i + 1} - \rho_i$. Let
$\mathcal{I}_i \subset \mathcal{O}_V$ be the ideal generated by the minors
of size $\rho_i \times \rho_i$ in the matrix of $d_i$.

\medskip\noindent
On the one hand, comparing with Lemma \ref{lemma-fitting-ideals-complex}
we see the ideal $\mathcal{I}_i$ corresponds to the global ideal
$\text{Fit}_{i, k_i}(E)$ which was shown to be
independent of the choice of the complex representing $E|_V$.
On the other hand, $\mathcal{I}_i$ is the $(n_{i + 1} - \rho_i)$th
Fitting ideal of $\Coker(d_i)$. Please keep this in mind.

\medskip\noindent
We let $b : X' \to X$ be the blowing up in the product of the ideals
$\text{Fit}_{i, k_i}(E)$; this makes sense as locally on $X$
almost all of these ideals are equal to the unit ideal (see above).
This blowup dominates the blowups $b_i : X'_i \to X$ in
the ideals $\text{Fit}_{i, k_i}(E)$, see
Divisors, Lemma \ref{divisors-lemma-blowing-up-two-ideals}.
By Divisors, Lemma \ref{divisors-lemma-blowup-fitting-ideal}
each $b_i$ is a $U$-admissible blowup. It follows that
$b$ is a $U$-admissible blowup (tiny detail omitted; compare with
the proof of Divisors, Lemma \ref{divisors-lemma-dominate-admissible-blowups}).
Finally, $U$ is still a scheme theoretically dense open subscheme of $X'$.
Thus after replacing $X$ by $X'$ we end up in the situation
discussed in the next paragraph.

\medskip\noindent
Assume $\text{Fit}_{i, k_i}(E)$ is an invertible ideal for all $i$.
Choose an affine open $V$ and a complex of finite free modules
representing $E|_V$ as above. It follows from
Divisors, Lemma \ref{divisors-lemma-blowup-fitting-ideal}
that $\Coker(d_i)$ has tor dimension $\leq 1$. Thus
$\Im(d_i)$ is finite locally free as the kernel of a map
from a finite locally free module to a finitely presented
module of tor dimension $\leq 1$. Hence $\Ker(d_i)$
is finite locally free as well (same argument). Thus the short
exact sequence
$$
0 \to \Im(d_{i - 1}) \to \Ker(d_i) \to H^i(E)|_V \to 0
$$
shows what we want and the proof is complete.
\end{proof}

\begin{lemma}
\label{lemma-blowup-complex-integral}
Let $X$ be an integral scheme. Let $E \in D(\mathcal{O}_X)$ be perfect.
Then there exists a nonempty open $U \subset X$
such that $H^i(E|_U)$ is finite locally free of constant rank $r_i$
for all $i \in \mathbf{Z}$ and there exists a $U$-admissible blowup
$b : X' \to X$ such that $H^i(Lb^*E)$ is a perfect
$\mathcal{O}_{X'}$-module of tor dimension $\leq 1$ for all $i \in \mathbf{Z}$.
\end{lemma}

\begin{proof}
We strongly urge the reader to find their own proof of the
existence of $U$. Let $\eta \in X$ be the generic point.
The restriction of $E$ to $\eta$ is isomorphic in $D(\kappa(\eta))$ to a
finite complex $V^\bullet$ of finite dimensional vector spaces with zero
differentials. Set $r_i = \dim_{\kappa(\eta)} V^i$.
Then the perfect object $E'$ in $D(\mathcal{O}_X)$ represented by the complex
with terms $\mathcal{O}_X^{\oplus r_i}$ and zero differentials
becomes isomorphic to $E$ after pulling back to $\eta$.
Hence by Derived Categories of Schemes, Lemma
\ref{perfect-lemma-descend-relatively-perfect}
there is an open neighbourhood $U$ of $\eta$ such that $E|_U$ and $E'|_U$
are isomorphic. This proves the first assertion. The second follows from the
first and Lemma \ref{lemma-blowup-complex} as any nonempty open is
scheme theoretically dense in the integral scheme $X$.
\end{proof}

\begin{remark}
\label{remark-when-you-have-a-complex}
Let $X$ be a scheme. Let $E \in D(\mathcal{O}_X)$ be a perfect object such
that $H^i(E)$ is a perfect $\mathcal{O}_X$-module of tor dimension $\leq 1$
for all $i \in \mathbf{Z}$. This property sometimes allows one to reduce
questions about $E$ to questions about $H^i(E)$. For example, suppose
$$
\mathcal{E}^a \xrightarrow{d^a} \ldots
\xrightarrow{d^{b - 2}} \mathcal{E}^{b - 1}
\xrightarrow{d^{b - 1}} \mathcal{E}^b
$$
is a bounded complex of finite locally free $\mathcal{O}_X$-modules
representing $E$. Then $\Im(d^i)$ and $\Ker(d^i)$ are finite locally
free $\mathcal{O}_X$-modules for all $i$. Namely, suppose by induction
we know this for all indices bigger than $i$. Then we can first use the
short exact sequence
$$
0 \to \Im(d^i) \to \Ker(d^{i + 1}) \to H^{i + 1}(E) \to 0
$$
and the assumption that $H^{i + 1}(E)$ is perfect of tor dimension $\leq 1$
to conclude that $\Im(d^i)$ is finite locally free.
The same argument used again for the short exact sequence
$$
0 \to \Ker(d^i) \to \mathcal{E}^i \to \Im(d^i) \to 0
$$
then gives that $\Ker(d^i)$ is finite locally free.
It follows that the distinguished triangles
$$
\tau_{\leq k - 1}E \to \tau_{\leq k}E \to H^k(E)[-k] \to
(\tau_{\leq k - 1}E)[1]
$$
are represented by the following short exact sequences of
bounded complexes of finite locally free modules
$$
\begin{matrix}
& &
& &
& &
0 \\
& &
& &
& &
\downarrow \\
\mathcal{E}^a & \to &
\ldots & \to &
\mathcal{E}^{k - 2} & \to &
\Ker(d^{k - 1}) \\
\downarrow & &
& &
\downarrow & &
\downarrow \\
\mathcal{E}^a & \to &
\ldots & \to &
\mathcal{E}^{k - 2} & \to &
\mathcal{E}^{k - 1} & \to &
\Ker(d^k) \\
& &
& &
& &
\downarrow & &
\downarrow \\
& &
& &
& &
\Im(d^{k - 1}) & \to &
\Ker(d^k) \\
& &
& &
& &
\downarrow \\
& &
& &
& &
0
\end{matrix}
$$
Here the complexes are the rows and the ``obvious'' zeros
are omitted from the display.
\end{remark}





\section{Blowing up perfect modules}
\label{section-blowup-perfect-modules}

\noindent
This section tries to find normal forms for perfect modules of tor dimension
$\leq 1$ after blowups. We are only partially successful.

\begin{lemma}
\label{lemma-blowup-pd1-derived}
Let $X$ be a scheme. Let $\mathcal{F}$ be a perfect
$\mathcal{O}_X$-module of tor dimension $\leq 1$. For any
blowup $b : X' \to X$ we have $Lb^*\mathcal{F} = b^*\mathcal{F}$
and $b^*\mathcal{F}$ is a perfect $\mathcal{O}_X$-module
of tor dimension $\leq 1$.
\end{lemma}

\begin{proof}
We may assume $X = \Spec(A)$ is affine and we may assume the $A$-module $M$
corresponding to $\mathcal{F}$ has a presentation
$$
0 \to A^{\oplus m} \to A^{\oplus n} \to M \to 0
$$
Suppose $I \subset A$ is an ideal and $a \in I$. Recall that the
affine blowup algebra $A[\frac{I}{a}]$ is a subring of $A_a$.
Since localization is exact we see that $A_a^{\oplus m} \to A_a^{\oplus n}$
is injective. Hence $A[\frac{I}{a}]^{\oplus m} \to A[\frac{I}{a}]^{\oplus n}$
is injective too. This proves the lemma.
\end{proof}

\begin{lemma}
\label{lemma-blowup-pd1}
Let $X$ be a scheme. Let $\mathcal{F}$ be a perfect $\mathcal{O}_X$-module
of tor dimension $\leq 1$. Let $U \subset X$ be a scheme theoretically
dense open such that $\mathcal{F}|_U$ is finite locally free of constant
rank $r$. Then there exists a $U$-admissible blowup $b : X' \to X$ such that
there is a canonical short exact sequence
$$
0 \to \mathcal{K} \to b^*\mathcal{F} \to \mathcal{Q} \to 0
$$
where $\mathcal{Q}$ is finite locally free of rank $r$ and
$\mathcal{K}$ is a perfect $\mathcal{O}_X$-module
of tor dimension $\leq 1$ whose restriction to $U$ is zero.
\end{lemma}

\begin{proof}
Combine Divisors, Lemma \ref{divisors-lemma-blowup-fitting-ideal} and
Lemma \ref{lemma-blowup-pd1-derived}.
\end{proof}

\begin{lemma}
\label{lemma-canonical-blowup-torsion-pd1}
Let $X$ be a scheme. Let $\mathcal{F}$ be a perfect $\mathcal{O}_X$-module
of tor dimension $\leq 1$. Let $U \subset X$ be an open such that
$\mathcal{F}|_U = 0$. Then there is a $U$-admissible blowup
$$
b : X' \to X
$$
such that $\mathcal{F}' = b^*\mathcal{F}$ is equipped with two canonical
locally finite filtrations
$$
0 = F^0 \subset F^1 \subset F^2 \subset \ldots \subset \mathcal{F}'
\quad\text{and}\quad
\mathcal{F}' = F_1 \supset F_2 \supset F_3 \supset \ldots \supset 0
$$
such that for each $n \geq 1$ there is an effective Cartier divisor
$D_n \subset X'$ with the property that
$$
F^i/F^{i - 1}
\quad\text{and}\quad
F_i/F_{i + 1}
$$
are finite locally free of rank $i$ on $D_i$.
\end{lemma}

\begin{proof}
Choose an affine open $V \subset X$ such that there exists a presentation
$$
0 \to \mathcal{O}_V^{\oplus n} \xrightarrow{A} \mathcal{O}_V^{\oplus n} \to
\mathcal{F} \to 0
$$
for some $n$ and some matrix $A$. The ideal we are going to blowup in
is the product of the Fitting ideals $\text{Fit}_k(\mathcal{F})$
for $k \geq 0$. This makes sense because in the affine
situation above we see that $\text{Fit}_k(\mathcal{F})|_V = \mathcal{O}_V$
for $k > n$. It is clear that this is a $U$-admissible blowing up. By
Divisors, Lemma \ref{divisors-lemma-blowing-up-two-ideals}
we see that on $X'$ the ideals $\text{Fit}_k(\mathcal{F})$
are invertible. Thus we reduce to the case discussed in the
next paragraph.

\medskip\noindent
Assume $\text{Fit}_k(\mathcal{F})$ is an invertible ideal for
$k \geq 0$. If $E_k \subset X$ is the effective
Cartier divisor defined by $\text{Fit}_k(\mathcal{F})$
for $k \geq 0$, then the effective Cartier divisors
$D_k$ in the statement of the lemma will satisfy
$$
E_k = D_{k + 1} + 2 D_{k + 2} + 3 D_{k + 3} + \ldots
$$
This makes sense as the collection $D_k$ will be locally finite.
Moreover, it uniquely determines the effective Cartier divisors $D_k$
hence it suffices to construct $D_k$ locally.

\medskip\noindent
Choose an affine open $V \subset X$ and presentation of $\mathcal{F}|_V$
as above. We will construct the divisors and filtrations by induction
on the integer $n$ in the presentation. We set $D_k|_V = \emptyset$
for $k > n$ and we set $D_n|V = E_{n - 1}|_V$.
After shrinking $V$ we may assume that
$\text{Fit}_{n - 1}(\mathcal{F})|_V$ is generated by a
single nonzerodivisor $f \in \Gamma(V, \mathcal{O}_V)$.
Since $\text{Fit}_{n - 1}(\mathcal{F})|_V$ is the ideal generated
by the entries of $A$, we see that there is a matrix
$A'$ in $\Gamma(V, \mathcal{O}_V)$ such that $A = fA'$.
Define $\mathcal{F}'$ on $V$ by the short exact sequence
$$
0 \to \mathcal{O}_V^{\oplus n} \xrightarrow{A'} \mathcal{O}_V^{\oplus n} \to
\mathcal{F}' \to 0
$$
Since the entries of $A'$ generate the unit ideal in
$\Gamma(V, \mathcal{O}_V)$ we see that $\mathcal{F}'$
locally on $V$ has a presentation with $n$ decreased
by $1$, see Algebra, Lemma \ref{algebra-lemma-add-trivial-complex}.
Further note that
$f^{n - k}\text{Fit}_k(\mathcal{F}') = \text{Fit}_k(\mathcal{F})|_V$
for $k = 0, \ldots, n$. Hence $\text{Fit}_k(\mathcal{F}')$
is an invertible ideal for all $k$. We conclude by induction
that there exist effective Cartier divisors $D'_k \subset V$
such that $\mathcal{F}'$ has two canonical filtrations as in the statement
of the lemma. Then we set $D_k|_V = D'_k$ for $k = 1, \ldots, n - 1$.
Observe that the equalities between effective Cartier divisors
displayed above hold with these choices. Finally, we come
to the construction of the filtrations. Namely,
we have short exact sequences
$$
0 \to
\mathcal{O}_{D_n \cap V}^{\oplus n} \to
\mathcal{F} \to \mathcal{F}' \to 0
\quad\text{and}\quad
0 \to
\mathcal{F}' \to \mathcal{F} \to
\mathcal{O}_{D_n \cap V}^{\oplus n} \to 0
$$
coming from the two factorizations $A = A'f = f A'$ of $A$.
These sequences are canonical because in the first one
the submodule is $\Ker(f : \mathcal{F} \to \mathcal{F})$
and in the second one the quotient module is
$\Coker(f : \mathcal{F} \to \mathcal{F})$.
\end{proof}

\begin{lemma}
\label{lemma-blowup-map-pd1}
Let $X$ be a scheme. Let $\varphi : \mathcal{F} \to \mathcal{G}$
be a homorphism of perfect $\mathcal{O}_X$-modules of tor dimension $\leq 1$.
Let $U \subset X$ be a scheme theoretically dense open
such that $\mathcal{F}|_U = 0$ and $\mathcal{G}|_U = 0$.
Then there is a $U$-admissible blowup $b : X' \to X$ such that
the kernel, image, and cokernel of $b^*\varphi$ are
perfect $\mathcal{O}_{X'}$-modules of tor dimension $\leq 1$.
\end{lemma}

\begin{proof}
The assumptions tell us that the object $(\mathcal{F} \to \mathcal{G})$
of $D(\mathcal{O}_X)$ is perfect. Thus we get a $U$-admissible blowup that
works for the cokernel and kernel by Lemmas \ref{lemma-blowup-complex}
and \ref{lemma-blowup-pd1-derived} (to see what the complex looks
like after pullback). The image is the kernel of the cokernel
and hence is going to be perfect of tor dimension $\leq 1$ as well.
\end{proof}











\section{An operator introduced by Berthelot and Ogus}
\label{section-eta}

\noindent
Please read Cohomology, Section \ref{cohomology-section-eta} first.

\medskip\noindent
Let $X$ be a scheme. Let $D \subset X$ be an effective
Cartier divisor. Let $\mathcal{I} = \mathcal{I}_D \subset \mathcal{O}_X$
be the ideal sheaf of $D$, see
Divisors, Section
\ref{divisors-section-effective-Cartier-invertible}.
Clearly we can apply the discussion in 
Cohomology, Section \ref{cohomology-section-eta} to $X$ and $\mathcal{I}$.

\begin{lemma}
\label{lemma-eta-stalks}
Let $X$ be a scheme. Let $D \subset X$ be an effective
Cartier divisor with ideal sheaf $\mathcal{I} \subset \mathcal{O}_X$.
Let $\mathcal{F}^\bullet$ be a complex of quasi-coherent
$\mathcal{O}_X$-modules such that $\mathcal{F}^i$ is
$\mathcal{I}$-torsion free for all $i$. Then
$\eta_\mathcal{I}\mathcal{F}^\bullet$ is a complex of
quasi-coherent $\mathcal{O}_X$-modules. Moreover,
if $U = \Spec(A) \subset X$ is affine open and $D \cap U = V(f)$,
then $\eta_f(\mathcal{F}^\bullet(U))$ is canonically isomorphic
to $(\eta_\mathcal{I}\mathcal{F}^\bullet)(U)$.
\end{lemma}

\begin{proof}
Omitted.
\end{proof}

\begin{lemma}
\label{lemma-Leta}
Let $X$ be a scheme. Let $D \subset X$ be an effective
Cartier divisor with ideal sheaf $\mathcal{I} \subset \mathcal{O}_X$.
The functor $L\eta_\mathcal{I} : D(\mathcal{O}_X) \to D(\mathcal{O}_X)$ of
Cohomology, Lemma \ref{cohomology-lemma-Leta} sends
$D_\QCoh(\mathcal{O}_X)$ into itself.
Moreover, if $X = \Spec(A)$ is affine and $D = V(f)$,
then the functor $L\eta_f$ on $D(A)$ defined in
More on Algebra, Lemma \ref{more-algebra-lemma-Leta}
and the functor $L\eta_\mathcal{I}$ on $D_\QCoh(\mathcal{O}_X)$
correspond via the equivalence of Derived Categories of Schemes, Lemma
\ref{perfect-lemma-affine-compare-bounded}.
\end{lemma}

\begin{proof}
Omitted.
\end{proof}





\section{Blowing up complexes, II}
\label{section-blowup-complexes-II}

\noindent
The material in this section will be used to construct a version of
Macpherson's graph construction in Section \ref{section-blowup-complexes-III}.
 
\begin{situation}
\label{situation-complex-and-divisor}
Here $X$ is a scheme, $D \subset X$ is an effective Cartier divisor
with ideal sheaf $\mathcal{I} \subset \mathcal{O}_X$, and
$M$ is a perfect object of $D(\mathcal{O}_X)$.
\end{situation}

\noindent
Let $(X, D, M)$ be a triple as in
Situation \ref{situation-complex-and-divisor}.
Consider an affine open $U = \Spec(A) \subset X$
such that
\begin{enumerate}
\item $D \cap U = V(f)$ for some nonzerodivisor $f \in A$, and
\item there exists a bounded complex $M^\bullet$ of
finite free $A$-modules representing $M|_U$ (via the equivalence of
Derived Categories of Schemes, Lemma
\ref{perfect-lemma-affine-compare-bounded}).
\end{enumerate}
We will say that $(U, A, f, M^\bullet)$ is an
{\it affine chart} for $(X, D, M)$.
Consider the ideals $I_i(M^\bullet, f) \subset A$ defined in
More on Algebra, Section \ref{more-algebra-section-perfect-eta}.
Let us say $(X, S, M)$ is a {\it good triple} if for every $x \in D$
there exists an affine chart $(U, A, f, M^\bullet)$
with $x \in U$ and $I_i(M^\bullet, f)$ principal ideals for all
$i \in \mathbf{Z}$.

\begin{lemma}
\label{lemma-pullback-triple-ideals-good}
In Situation \ref{situation-complex-and-divisor} let $h : Y \to X$ be a
morphism of schemes such that the pullback $E = h^{-1}D$ of $D$
is defined (Divisors, Definition
\ref{divisors-definition-pullback-effective-Cartier-divisor}).
Let $(U, A, f, M^\bullet)$ is an affine chart for $(X, D, M)$.
Let $V = \Spec(B) \subset Y$ is an affine open with $h(V) \subset U$.
Denote $g \in B$ the image of $f \in A$.
Then
\begin{enumerate}
\item $(V, B, g, M^\bullet \otimes_A B)$ is an affine chart for $(Y, E, Lh^*M)$,
\item $I_i(M^\bullet, f)B = I_i(M^\bullet \otimes_A B, g)$ in $B$, and
\item if $(X, D, M)$ is a good triple, then
$(Y, E, Lh^*M)$ is a good triple.
\end{enumerate}
\end{lemma}

\begin{proof}
The first statement follows from the following observations:
$g$ is a nonzerodivisor in $B$ which defines $E \cap V \subset V$
and $M^\bullet \otimes_A B$ represents $M^\bullet \otimes_A^\mathbf{L} B$
and hence represents the pullback of $M$ to $V$ by
Derived Categories of Schemes, Lemma
\ref{perfect-lemma-quasi-coherence-pullback}.
Part (2) follows from part (1) and
More on Algebra, Lemma \ref{more-algebra-lemma-eta-base-change-pre}.
Combined with
More on Algebra, Lemma \ref{more-algebra-lemma-eta-base-change-pre}
we conclude that the second statement of the lemma holds.
\end{proof}

\begin{lemma}
\label{lemma-good-triple}
Let $X, D, \mathcal{I}, M$ be as in
Situation \ref{situation-complex-and-divisor}.
If $(X, D, M)$ is a good triple, then
$L\eta_\mathcal{I}M$ is a perfect object
of $D(\mathcal{O}_X)$.
\end{lemma}

\begin{proof}
Translation of
More on Algebra, Lemma \ref{more-algebra-lemma-eta-locally-free}.
To do the translation use Lemma \ref{lemma-Leta}.
\end{proof}

\begin{lemma}
\label{lemma-good-triple-bdd-loc-free}
Let $X, D, \mathcal{I}, M$ be as in
Situation \ref{situation-complex-and-divisor}.
Assume $(X, D, M)$ is a good triple.
If there exists a locally bounded complex $\mathcal{M}^\bullet$
of finite locally free $\mathcal{O}_X$-modules representing $M$,
then there exists a locally bounded complex $\mathcal{Q}^\bullet$
of finite locally free $\mathcal{O}_{X'}$-modules representing
$L\eta_\mathcal{I}M$.
\end{lemma}

\begin{proof}
By Cohomology, Lemma \ref{cohomology-lemma-Leta}
the complex $\mathcal{Q}^\bullet = \eta_\mathcal{I}\mathcal{M}^\bullet$
represents $L\eta_\mathcal{I}M$. To check that this complex
is locally bounded and consists of finite locally free, we may work
affine locally. Then the boundedness is clear.
Choose an affine chart $(U, A, f, M^\bullet)$ for $(X, D, M)$
such that the ideals $I_i(M^\bullet, f)$ are principal and such that
$\mathcal{M}^i|_U$ is finite free for each $i$. By our assumption
that $(X, D, M)$ is a good triple we can do this. Writing
$N^i = \Gamma(U, \mathcal{M}^i|_U)$ we get a bounded
complex $N^\bullet$ of finite free $A$-modules representing the
same object in $D(A)$ as the complex $M^\bullet$ (by
Derived Categories of Schemes, Lemma
\ref{perfect-lemma-affine-compare-bounded}).
Then $I_i(N^\bullet, f)$ is a principal ideal for all $i$
by More on Algebra, Lemma \ref{more-algebra-lemma-ideal-well-defined}.
Hence the complex $\eta_fN^\bullet$ is a bounded complex
of finite locally free $A$-modules. Since
$\mathcal{Q}^i|_U$ is the quasi-coherent $\mathcal{O}_U$-module
corresponding to $\eta_fN^i$ by Lemma \ref{lemma-eta-stalks} we conclude.
\end{proof}

\begin{lemma}
\label{lemma-complex-and-divisor-eta-pull}
In Situation \ref{situation-complex-and-divisor} let $h : Y \to X$
be a morphism of schemes such that the pullback $E = h^{-1}D$
is defined. If $(X, D, M)$ is a good triple, then
$$
Lh^*(L\eta_\mathcal{I}M) = L\eta_\mathcal{J}(Lh^*M)
$$
in $D(\mathcal{O}_Y)$ where $\mathcal{J}$ is the ideal sheaf of $E$.
\end{lemma}

\begin{proof}
Translation of
More on Algebra, Lemma \ref{more-algebra-lemma-eta-base-change}.
Use Lemmas \ref{lemma-eta-stalks} and \ref{lemma-Leta}
to do the translation.
\end{proof}

\begin{lemma}
\label{lemma-complex-and-divisor-blowup-pre}
In Situation \ref{situation-complex-and-divisor}
there is a unique morphism $b : X' \to X$ such that
\begin{enumerate}
\item the pullback $D' = b^{-1}D$ is defined and
$(X', D', M')$ is a good triple where $M' = Lb^*M$, and
\item for any morphism of schemes $h : Y \to X$ such that
the pullback $E = h^{-1}D$ is defined and $(Y, E, Lh^*M)$
is a good triple, there is a unique factorization of $h$ through $b$.
\end{enumerate}
Moreover, for any affine chart $(U, A, f, M^\bullet)$ the restriction
$b^{-1}(U) \to U$ is the blowing up in the product of the ideals
$I_i(M^\bullet, f)$ and for any quasi-compact open $W \subset X$ the
restriction $b|_{b^{-1}(W)} : b^{-1}(W) \to W$ is a $W \setminus D$-admissible
blowing up.
\end{lemma}

\begin{proof}
The proof is just that we will locally blow up $X$ in the product ideals
$I_i(M^\bullet, f)$ for any affine chart $(U, A, f, M^\bullet)$.
The first few lemmas in More on Algebra, Section
\ref{more-algebra-section-perfect-eta} show that this is well defined.
The universal property (2) then follows from the
universal property of blowing up.
The details can be found below.

\medskip\noindent
Let $U, A, f, M^\bullet$ be an affine chart for $(X, D, M)$.
All but a finite number of the ideals $I_i(M^\bullet, f)$ are
equal to $A$ hence it makes sense to look at
$$
I = \prod\nolimits_i I_i(M^\bullet, f)
$$
and this is a finitely generated ideal of $A$. Denote
$$
b_U : U' \to U
$$
the blowing up of $U$ in $I$. Then $b_U^{-1}(U \cap D)$ is defined by
Divisors, Lemma
\ref{divisors-lemma-blow-up-pullback-effective-Cartier}.
Recall that $f^{r_i} \in I_i(M^\bullet, f)$ and hence
$b_U$ is a $(U \setminus D)$-admissible blowing up.
By Divisors, Lemma \ref{divisors-lemma-blowing-up-two-ideals}
for each $i$ the morphism $b_U$ factors as $U' \to U'_i \to U$
where $U'_i \to U$ is the blowing up in $I_i(M^\bullet, f)$
and $U' \to U'_i$ is another blowing up. It follows that
the pullback $I_i(M^\bullet, f)\mathcal{O}_{U'}$
of $I_i(M^\bullet, f)$ to $U'$ is an invertible ideal sheaf, see
Divisors, Lemmas \ref{divisors-lemma-blow-up-pullback-effective-Cartier} and
\ref{divisors-lemma-blowing-up-gives-effective-Cartier-divisor}.
It follows that $(U', b^{-1}D, Lb^*M|_U)$ is a good triple, see
Lemma \ref{lemma-pullback-triple-ideals-good}
for the behaviour of the ideals $I_i(-,-)$ under pullback.
Finally, we claim that $b_U : U' \to U$ has the universal property
mentioned in part (2) of the statement of the lemma. Namely, suppose
$h : Y \to U$ is a morphism of schemes such that
the pullback $E = h^{-1}(D \cap U)$ is defined and $(Y, E, Lh^*M)$
is a good triple. Then $Y$ is covered by affine charts
$(V, B, g, N^\bullet)$ such that $I_i(N^\bullet, g)$ is
an invertible ideal for each $i$. Then $g$ and the image of
$f$ in $B$ differ by a unit as they both cut out the effective
Cartier divisor $E \cap V$. Hence we may assume $g$ is the image of $f$ by
More on Algebra, Lemma \ref{more-algebra-lemma-eta-change-unit}.
Then $I_i(N^\bullet, g)$ is isomorphic to $I_i(M^\bullet \otimes_A B, g)$
as a $B$-module by More on Algebra, Lemma
\ref{more-algebra-lemma-ideal-well-defined}.
Thus $I_i(M^\bullet \otimes_A B, g) = I_i(M^\bullet, f)B$
(Lemma \ref{lemma-pullback-triple-ideals-good})
is an invertible $B$-module.
Hence the ideal $IB$ is invertible. It follows that $I\mathcal{O}_Y$
is invertible. Hence we obtain a unique factorization of $h$ through
$b_U$ by Divisors, Lemma \ref{divisors-lemma-universal-property-blowing-up}.

\medskip\noindent
Let $\mathcal{B}$ be the set of affine opens $U \subset X$
such that there exists an affine chart $(U, A, f, M^\bullet)$
for $(X, D, M)$. Then $\mathcal{B}$ is a basis for the topology
on $X$; details omitted. For $U \in \mathcal{B}$ we have
the morphism $b_U : U' \to U$ constructed above which satisfies
the universal property over $U$. If $U_1 \subset U_2 \subset X$
are both in $\mathcal{B}$, then $b_{U_1} : U'_1 \to U_1$
is canonically isomorphic to
$$
b_{U_2}|_{b_{U_2}^{-1}(U_1)} : b_{U_2}^{-1}(U_1) \longrightarrow U_1
$$
by the universal property. In other words, we get an isomorphism
$U'_1 \to b_{U_2}^{-1}(U_1)$ over $U_1$. These isomorphisms satisfy
the cocycle condition (again by the universal property) and hence by
Constructions, Lemma \ref{constructions-lemma-relative-glueing}
we get a morphism $b : X' \to X$ whose restriction to each
$U$ in $\mathcal{B}$ is isomorphic to $U' \to U$.
Then the morphism $b : X' \to X$ satisfies properties (1) and (2)
of the statement of the lemma as these properties may be checked
locally (details omitted).

\medskip\noindent
We still have to prove the final assertion of the lemma.
Let $W \subset X$ be a quasi-compact open.
Choose a finite covering $W = U_1 \cup \ldots \cup U_T$
such that for each $1 \leq t \leq T$ there exists an affine chart
$(U_t, A_t, f_t, M_t^\bullet)$. We will use below that for any affine
open $V = \Spec(B) \subset U_t \cap U_{t'}$ we have
(a) the images of $f_t$ and $f_{t'}$ in $B$ differ by a unit, and
(b) the complexes $M_t^\bullet \otimes_A B$ and $M_{t'} \otimes_A B$
define isomorphic objects of $D(B)$. For $i \in \mathbf{Z}$, set
$$
N_i = \max\nolimits_{t = 1, \ldots, T}
\left(\sum\nolimits_{j \geq i} (-1)^{j - i} rk(M_t^j)\right)
$$
Then $N_t - \sum\nolimits_{j \geq i} (-1)^{j - i} rk(M_t^j) \geq 0$
and we can consider the ideals
$$
I_{t, i} =
f_t^{N_i - \sum\nolimits_{j \geq i} (-1)^{j - i} rk(M_t^j)}
I_i(M_t^\bullet, f_t)
\subset A_t
$$
It follows from More on Algebra, Lemmas
\ref{more-algebra-lemma-eta-change-unit} and
\ref{more-algebra-lemma-ideal-well-defined}
that the ideals $I_{t, i}$ glue to a quasi-coherent, finite type
ideal $\mathcal{I}_i \subset \mathcal{O}_W$. Moreover, all but
a finite number of these ideals are equal to $\mathcal{O}_W$.
Clearly, the morphism $X' \to X$ constructed above
restricts to the blowing up of $W$ in the product
of the ideals $\mathcal{I}_i$. This finishes the proof.
\end{proof}

\begin{lemma}
\label{lemma-complex-and-divisor-blowup}
In Situation \ref{situation-complex-and-divisor} let $b : X' \to X$
be the morphism of Lemma \ref{lemma-complex-and-divisor-blowup-pre}.
Consider the effective Cartier divisor $D' = b^{-1}D$ with ideal sheaf
$\mathcal{I}' \subset \mathcal{O}_{X'}$. Then $Q = L\eta_{\mathcal{I}'}Lb^*M$
is a perfect object of $D(\mathcal{O}_{X'})$.
\end{lemma}

\begin{proof}
Follows from Lemmas \ref{lemma-complex-and-divisor-blowup-pre}
and \ref{lemma-good-triple}.
\end{proof}

\begin{lemma}
\label{lemma-complex-and-divisor-blowup-base-change}
In Situation \ref{situation-complex-and-divisor} let $h : Y \to X$
be a morphism of schemes such that the pullback $E = h^{-1}D$
is defined. Let $b : X' \to X$, resp.\ $c : Y' \to Y$ be as constructed in
Lemma \ref{lemma-complex-and-divisor-blowup-pre} for
$D \subset X$ and $M$, resp.\ $E \subset Y$ and $Lh^*M$.
Then $Y'$ is the strict transform of $Y$ with respect to $b : X' \to X$
(see proof for a precise formulation of this) and
$$
L\eta_{\mathcal{J}'}L(h \circ c)^*M = L(Y' \to X')^*Q
$$
where $Q = L\eta_{\mathcal{I}'}Lb^*M$ as in
Lemma \ref{lemma-complex-and-divisor-blowup}.
In particular, if $(Y, E, Lh^*M)$ is a good triple and
$k : Y \to X'$ is the unique morphism such that
$h = b \circ k$, then $L\eta_\mathcal{J}Lh^*M = Lk^*Q$.
\end{lemma}

\begin{proof}
Denote $E' = c^{-1}E$. Then $(Y', E', L(h \circ c)^*M)$ is a good
triple. Hence by the universal property of
Lemma \ref{lemma-complex-and-divisor-blowup-pre}
there is a unique morphism
$$
h' : Y' \longrightarrow X'
$$
such that $b \circ h' = h \circ c$. In particular, there is a morphism
$(h', c) : Y' \to X' \times_X Y$. We claim that given $W \subset X$
quasi-compact open, such that $b^{-1}(W) \to W$ is a blowing up,
this morphism identifies $Y'|_W$ with the strict transform of $Y_W$
with respect to $b^{-1}(W) \to W$. In turn, to see this is true
is a local question on $W$, and we may therefore prove the
statement over an affine chart. We do this in the next paragraph.

\medskip\noindent
Let $(U, A, f, M^\bullet)$ be an affine chart for $(X, D, M)$.
Recall from the proof of Lemma \ref{lemma-complex-and-divisor-blowup}
that the restriction of $b : X' \to X$ to $U$ is the blowing
up of $U = \Spec(A)$ in the product of the ideals $I_i(M^\bullet, f)$.
Now if $V = \Spec(B) \subset Y$ is any affine open with $h(V) \subset U$,
then $(V, B, g, M^\bullet \otimes_A B)$ is an affine chart for
$(Y, E, Lh^*M)$ where $g \in B$ is the image of $f$, see
Lemma \ref{lemma-pullback-triple-ideals-good}.
Hence the restriction of $c : Y' \to Y$ to $V$
is the blowing up in the product of the ideals
$I_i(M^\bullet, f)B$, i.e., the morphism $c : Y' \to Y$ over
$h^{-1}(U)$ is the blowing up of $h^{-1}(U)$ in the
ideal $\prod I_i(M^\bullet, f) \mathcal{O}_{h^{-1}(U)}$.
Since this is also true for the strict transform, we see that
our claim on strict transforms is true.

\medskip\noindent
Having said this the equality
$L\eta_{\mathcal{J}'}L(h \circ c)^*M = L(Y' \to X')^*Q$
follows from
Lemma \ref{lemma-complex-and-divisor-eta-pull}.
The final statement is a special case of this
(namely, the case where $c = \text{id}_Y$ and $k = h'$).
\end{proof}

\begin{lemma}
\label{lemma-complex-and-divisor-blowup-good}
In Situation \ref{situation-complex-and-divisor} let $W \subset X$
be the maximal open subscheme over which the cohomology sheaves
of $M$ are locally free. Then the morphism $b : X' \to X$
of Lemma \ref{lemma-complex-and-divisor-blowup-pre} is an isomorphism
over $W$.
\end{lemma}

\begin{proof}
This is true because for any affine chart $(U, A, f, M^\bullet)$
with $U \subset W$ we have that $I_i(M^\bullet, f)$ are locally
generated by a power of $f$ by
More on Algebra, Lemma \ref{more-algebra-lemma-eta-cohomology-free}.
Since $f$ is a nonzerodivisor,
the blowing up $b^{-1}(U) \to U$ is an isomorphism.
\end{proof}

\begin{lemma}
\label{lemma-complex-and-divisor-blowup-good-T}
Let $X, D, \mathcal{I}, M$ be as in
Situation \ref{situation-complex-and-divisor}.
If $(X, D, M)$ is a good triple, then there exists a
closed immersion
$$
i : T \longrightarrow D
$$
of finite presentation with the following properties
\begin{enumerate}
\item $T$ scheme theoretically contains $D \cap W$
where $W \subset X$ is the maximal open over which the
cohomology sheaves of $M$ are locally free,
\item the cohomology sheaves of $Li^*L\eta_\mathcal{I}M$
are locally free, and
\item for any point $t \in T$ with image $x = i(t) \in W$ the rank
of $H^i(M)_x$ over $\mathcal{O}_{X, x}$ and the rank
of $H^i(Li^*L\eta_\mathcal{I}M)_t$ over $\mathcal{O}_{T, t}$ agree.
\end{enumerate}
\end{lemma}

\begin{proof}
Let $(U, A, f, M^\bullet)$ be an affine chart for $(X, D, M)$
such that $I_i(M^\bullet, f)$ is a principal ideal for all $i \in \mathbf{Z}$.
Then we define $T \cap U \subset D \cap U$ as the closed subscheme
defined by the ideal
$$
J(M^\bullet, f) = \sum J_i(M^\bullet, f) \subset A/fA
$$
studied in More on Algebra, Lemmas
\ref{more-algebra-lemma-eta-vanishing-beta-plus-pre} and
\ref{more-algebra-lemma-eta-vanishing-beta-plus};
in terms of the second lemma we see that $T \cap U \to D \cap U$
is given by the ring map $A/fA \to C$ studied there.
Since $(X, D, M)$ is a good triple we can cover $X$ by
affine charts of this form and by the first of the two
lemmas, this construction glues. Hence we obtain a closed
subscheme $T \subset D$ which on good affine charts as above
is given by the ideal $J(M^\bullet, f)$. Then properties
(1) and (2) follow from the second lemma. Details omitted.
Small observation to help the reader:
since $\eta_fM^\bullet$ is a complex of locally free modules
by More on Algebra, Lemma \ref{more-algebra-lemma-eta-locally-free}
we see that $Li^*L\eta_\mathcal{I}M|_{T \cap U}$
is represented by the complex $\eta_fM^\bullet \otimes_A C$
of $C$-modules. The statement (3) on ranks follows from
Cohomology, Lemma \ref{cohomology-lemma-eta-cohomology-locally-free}.
\end{proof}

\begin{lemma}
\label{lemma-complex-and-divisor-blowup-T}
In Situation \ref{situation-complex-and-divisor}. Let $b : X' \to X$
and $D'$ be as in Lemma \ref{lemma-complex-and-divisor-blowup-pre}. Let
$Q = L\eta_{\mathcal{I}'}Lb^*M$ be as in
Lemma \ref{lemma-complex-and-divisor-blowup}.
Let $W \subset X$ be the maximal open where $M$ has
locally free cohomology modules.
Then there exists a closed immersion $i : T \to D'$ of finite presentation
such that
\begin{enumerate}
\item $D' \cap b^{-1}(W) \subset T$ scheme theoretically,
\item $Li^*Q$ has locally free cohomology sheaves, and
\item for $t \in T$ mapping to $w \in W$ the rank
of $H^i(Li^*Q)_t$ over $\mathcal{O}_{T, t}$ is equal to the
rank of $H^i(M)_x$ over $\mathcal{O}_{X, x}$.
\end{enumerate}
\end{lemma}

\begin{proof}
Lemma \ref{lemma-complex-and-divisor-blowup-good} tells us that
$b$ is an isomorphism over $W$. Hence $b^{-1}(W) \subset X'$
is contained in the maximal open $W' \subset X'$ where $Lb^*M$
has locally free cohomology sheaves. Then the actual statements
in the lemma are an immediate consequence of
Lemma \ref{lemma-complex-and-divisor-blowup-good-T} applied
to $(X', D', Lb^*M)$ and the other lemmas mentioned in the statement.
\end{proof}

\begin{lemma}
\label{lemma-complex-and-divisor-blowup-T-ranks}
In Situation \ref{situation-complex-and-divisor}. Let $b : X' \to X$,
$D' \subset X'$, and $Q$ be as in
Lemma \ref{lemma-complex-and-divisor-blowup}.
Let $\rho = (\rho_i)_{i \in \mathbf{Z}}$ be integers.
Let $W(\rho) \subset X$ be the maximal open subscheme where
$H^i(M)$ is locally free of rank $\rho_i$ for all $i$.
Let $i : T \to D'$ be as in Lemma \ref{lemma-complex-and-divisor-blowup-T}.
Then there exists an open and closed subscheme $T(\rho) \subset T$
containing $D' \cap b^{-1}(W(\rho))$ scheme theoretically
such that $H^i(Li^*Q|_{T(\rho)})$ is locally free of rank $\rho_i$
for all $i$.
\end{lemma}

\begin{proof}
Let $T(\rho) \subset T$ be the open and closed subscheme
where $H^i(Li^*Q)$ has rank $\rho_i$ for all $i$. Then the statement
is immediate from the assertion in
Lemma \ref{lemma-complex-and-divisor-blowup-T}
on ranks of the cohomology modules.
\end{proof}

\begin{lemma}
\label{lemma-complex-and-divisor-blowup-T-represented-bdd-loc-free}
In Situation \ref{situation-complex-and-divisor}. Let $b : X' \to X$,
$D' \subset X'$, and $Q$ be as in
Lemma \ref{lemma-complex-and-divisor-blowup}.
If there exists a locally bounded complex $\mathcal{M}^\bullet$
of finite locally free $\mathcal{O}_X$-modules representing $M$,
then there exists a locally bounded complex $\mathcal{Q}^\bullet$
of finite locally free $\mathcal{O}_{X'}$-modules representing $Q$.
\end{lemma}

\begin{proof}
Recall that $Q = L\eta_{\mathcal{I}'}Lb^*M$ where $\mathcal{I}'$ is the
ideal sheaf of the effective Cartier divisor $D'$.
The locally bounded complex
$(\mathcal{M}')^\bullet = b^*\mathcal{M}^\bullet$ of
finite locally free $\mathcal{O}_{X'}$-modules
represents $Lb^*M$. Thus the lemma follows from
Lemma \ref{lemma-good-triple-bdd-loc-free}.
\end{proof}

\begin{lemma}
\label{lemma-complex-and-divisor-derived}
Let $X$ be a scheme and let $D \subset X$ be an effective Cartier divisor. Let
$M \in D(\mathcal{O}_X)$ be a perfect object. Let $W \subset X$ be the maximal
open over which the cohomology sheaves $H^i(M)$ are locally free.
There exists a proper morphism $b : X' \longrightarrow X$
and an object $Q$ in $D(\mathcal{O}_{X'})$ with the following properties
\begin{enumerate}
\item $b : X' \to X$ is an isomorphism over $X \setminus D$,
\item $b : X' \to X$ is an isomorphism over $W$,
\item $D' = b^{-1}D$ is an effective Cartier divisor,
\item $Q = L\eta_{\mathcal{I}'}Lb^*M$ where $\mathcal{I}'$
is the ideal sheaf of $D'$,
\item $Q$ is a perfect object of $D(\mathcal{O}_{X'})$,
\item there exists a closed immersion $i : T \to D'$ of finite presentation
such that
\begin{enumerate}
\item $D' \cap b^{-1}(W) \subset T$ scheme theoretically,
\item $Li^*Q$ has finite locally free cohomology sheaves,
\item for $t \in T$ with image $w \in W$ the rank
of $H^i(Li^*Q)_t$ over $\mathcal{O}_{T, t}$ is equal to the
rank of $H^i(M)_x$ over $\mathcal{O}_{X, x}$,
\end{enumerate}
\item for any affine chart $(U, A, f, M^\bullet)$ for $(X, D, M)$
the restriction of $b$ to $U$ is the blowing up of $U = \Spec(A)$
in the ideal $I = \prod I_i(M^\bullet, f)$, and
\item for any affine chart $(V, B, g, N^\bullet)$ for $(X', D', Lb^*N)$
such that $I_i(N^\bullet, g)$ is principal, we have
\begin{enumerate}
\item $Q|_V$ corresponds to $\eta_gN^\bullet$,
\item $T \subset V \cap D'$ corresponds to the ideal
$J(N^\bullet, g) = \sum J_i(N^\bullet, g) \subset B/gB$
studied in
More on Algebra, Lemma \ref{more-algebra-lemma-eta-vanishing-beta-plus}.
\end{enumerate}
\item If $M$ can be represented by a locally bounded complex
of finite locally free $\mathcal{O}_X$-modules, then $Q$ can
be represented by a bounded complex of finite locally free
$\mathcal{O}_{X'}$-modules.
\end{enumerate}
\end{lemma}

\begin{proof}
This statement collects the information obtained in
Lemmas \ref{lemma-pullback-triple-ideals-good},
\ref{lemma-good-triple},
\ref{lemma-complex-and-divisor-eta-pull},
\ref{lemma-complex-and-divisor-blowup-pre},
\ref{lemma-complex-and-divisor-blowup},
\ref{lemma-complex-and-divisor-blowup-base-change},
\ref{lemma-complex-and-divisor-blowup-good},
\ref{lemma-complex-and-divisor-blowup-good-T},
\ref{lemma-complex-and-divisor-blowup-T}, and
\ref{lemma-complex-and-divisor-blowup-T-represented-bdd-loc-free}.
\end{proof}










\section{Blowing up complexes, III}
\label{section-blowup-complexes-III}

\noindent
In this section we give an ``algebra version'' of the version of
Macpherson's graph construction given in \cite[Section 18.1]{F}.

\medskip\noindent
Let $X$ be a scheme. Let $E$ be a perfect object of $D(\mathcal{O}_X)$.
Let $U \subset X$ be the maximal open subscheme such that
$E|_U$ has locally free cohomology sheaves.

\medskip\noindent
Consider the commutative diagram
$$
\xymatrix{
\mathbf{A}^1_X \ar[r] \ar[rd] &
\mathbf{P}^1_X \ar[d]^p &
(\mathbf{P}^1_X)_\infty \ar[l] \ar[ld] \\
& X \ar@/_1em/[ur]_\infty
}
$$
Here we recall that $\mathbf{A}^1 = D_+(T_0)$ is the first standard
affine open of $\mathbf{P}^1$ and that $\infty = V_+(T_0)$ is the
complementary effective Cartier divisor and the diagram above
is the pullback of these schemes to $X$. Observe that
$\infty : X \to (\mathbf{P}^1_X)_\infty$ is an isomorphism.
Then
$$
(\mathbf{P}^1_X, (\mathbf{P}^1_X)_\infty, Lp^*E)
$$
is a triple as in Situation \ref{situation-complex-and-divisor}
in Section \ref{section-blowup-complexes-II}.
Let
$$
b : W \longrightarrow \mathbf{P}^1_X\quad\text{and}\quad
W_\infty = b^{-1}((\mathbf{P}^1_X)_\infty)
$$
be the blowing up and effective Cartier divisor constructed
starting with this triple in
Lemma \ref{lemma-complex-and-divisor-blowup-pre}.
We also denote
$$
Q = L\eta_{\mathcal{I}} Lb^*M = L\eta_\mathcal{I} L(p \circ b)^*E
$$
the perfect object of $D(\mathcal{O}_W)$
considered in Lemma \ref{lemma-complex-and-divisor-blowup}.
Here $\mathcal{I} \subset \mathcal{O}_W$ is the ideal sheaf
of $W_\infty$.

\begin{lemma}
\label{lemma-graph-construction}
The construction above has the following properties:
\begin{enumerate}
\item $b$ is an isomorphism over $\mathbf{P}^1_U \cup \mathbf{A}^1_X$,
\item the restriction of $Q$ to $\mathbf{A}^1_X$
is equal to the pullback of $E$,
\item there exists a closed immersion $i : T \to W_\infty$
of finite presentation such that $(W_\infty \to X)^{-1}U \subset T$
scheme theoretically and such that $Li^*Q$ has locally free cohomology
sheaves,
\item for $t \in T$ with image $u \in U$ we have that the
rank $H^i(Li^*Q)_t$ over $\mathcal{O}_{T, t}$ is equal to the rank
of $H^i(M)_u$ over $\mathcal{O}_{U, u}$,
\item if $E$ can be represented by a locally bounded complex of
finite locally free $\mathcal{O}_X$-modules, then $Q$ can be represented
by a locally bounded complex of finite locally free $\mathcal{O}_W$-modules.
\end{enumerate}
\end{lemma}

\begin{proof}
This follows immediately from the results in
Section \ref{section-blowup-complexes-II}; for a statement
collecting everything needed, see
Lemma \ref{lemma-complex-and-divisor-derived}.
\end{proof}











\input{chapters}


\bibliography{my}
\bibliographystyle{amsalpha}

\end{document}
